routehandler-express
v1.1.4
Published
Route handling untuk express agar mudah
Downloads
5
Readme
1. how to setup routerhandler-express on express
const { routeHandler } = require("routehandler-express");
const express = require("express");
const port = 3000 || porcess.env.PORT;
const app = express();
const path = process.cwd();
routeHandler(app, path + "/route");
app.listen(port, () => {
console.log(`app listening on port ${port}`);
});
2. you need to add a route
example :
3. you need to fill in module.exports in the file
//you add file "home.js" in route
module.exports = {
name:"/",
disable:false ? true,
method: "get", // get, post, put etc
run : (req,res) => {
res.send("Hello To World")
}
}