Package Exports
- wowter
- wowter/Router.js
- wowter/middleware
- wowter/middleware.js
- wowter/package.json
Readme
Wowter 😲
A simple router for node.js
A VERY barebones router for node.js. It's called wowter because that's what it sounds like when a cute child tries to say router, and the design is so naive and simple that it's like a child made it.
Usage
import { createRouter } from "wowter"
import { CORS, JSONParser, FileUpload } from "wowter/middleware"
const dir = "./public"
const uploadDir = "./uploads"
const middleware = [CORS, JSONParser]
const routes = {
"/api/upload": {
"/upload": {
POST: (req, res) => {
FileUpload({
dir: uploadDir,
maxFileSize: 1000000,
})
},
},
},
"/special": {
GET: (req, res) => {
res.end("You found the secret!")
},
},
}
const router = createRouter(routes, middleware, dir)
router.listen(8080, () => {
console.log("Listening on port 8080")
})
Installation
npm install wowter
# or
bun install wowter
# or
yarn add wowter
# or
pnpm add wowter