0.0.4 • Published 7 years ago
arsf-static-route v0.0.4
Installation
yarn add arsf-static-routeUsage
staticRoute(mode, callback, options)
- mode: between
compileto compile pages orserveto serve pages dynamically. - callback: a
function(ctx). Context will be passed to manipulate the output pages.ctx.send(body)is the final data which will be sent.
- options: staticRoute options
portinteger, for server (default:3000)outputpath string, to compile (default:process.cwd() + /dist)staticarray of path string (directory), served as static filescleanboolean, clean old output before compiling
Example:
const staticRoute = require('arsf-static-route')
staticRoute('serve', router => {
router('/', ctx => ctx.send('Hello World'))
router('/about', ctx => ctx.send('This is about page'))
})