coalcodes-route-builder
Version:
A library to create routes based on comments (like symfony) or configurations (like yaml, json, etc)
19 lines (15 loc) • 389 B
JavaScript
import builder from "../../index.js";
import express from "express";
builder('./controllers', './routes')
import Routing from './routes/index.js'
const app = express();
app.use((req, res, next) => {
req.user = {
role: 'ADMIN'
}
next()
})
app.use(Routing(new express.Router()));
app.listen(3000, () => {
console.log('listening on port 3000')
})