API Reference

Core Methods

Method Description Example
get(path, handler) Define GET route app.get('/', (req, res) => {...})
post(path, handler) Define POST route app.post('/users', (req, res) => {...})
put(path, handler) Define PUT route app.put('/users/:id', (req, res) => {...})
delete(path, handler) Define DELETE route app.delete('/users/:id', (req, res) => {...})
at(port, host, callback) Start server app.at(3000, () => {...})
on(status, handler) Error handler app.on(404, () => 'Not found')

Middleware Methods

Method Description Example
useMiddleware(fn) Add standard middleware app.useMiddleware((req, res, next) => {...})
useErrorMiddleware(fn) Add error middleware app.useErrorMiddleware((err, req, res, next) => {...})
serveStatic(dir) Serve static files app.serveStatic('public')

Configuration Methods

Method Description Example
cors(options) Configure CORS app.cors({ origins: ['*'] })
setFileSizeLimit(mb) Set upload limit app.setFileSizeLimit(50)
style(css) Global CSS app.style = 'body { color: red }'
js(script) Global JavaScript app.js = 'console.log("Hello")'

Request Object

Property Description Type
req.method HTTP method (GET, POST, etc.) String
req.url Request URL String
req.query Parsed query parameters Object
req.params Route parameters Object
req.body Parsed request body Object
req.files Uploaded files Object
req.protocol Request protocol (http/https) String
req.fullUrl Complete request URL String
req.ip Client IP address String

Response Methods

Method Description Example
res.status(code) Set HTTP status res.status(404)
res.json(data) Send JSON response res.json({ success: true })
res.redirect(url) Redirect to URL res.redirect('/home')
res.send(content, contentType) Send raw content res.send('Hello World', 'text/plain')
res.set(headers) Set multiple headers res.set({ 'X-Custom': 'value' })

Plugin System

Method Description Example
usePlugin(plugin, options) Extend framework functionality with plugins app.usePlugin(myPlugin, { config: true })

View Engine Methods

Method Description Example
setViewEngine(engine, options) Configure template engine app.setViewEngine('novax', { viewsPath: './views' })
render(file, data) Render template with data await app.render('home', { title: 'Home' })