express-quickrouter
v1.2.1
Published
Author: Dhruv Dhagai: [email protected]
Downloads
22
Readme
Run The Following commands in your terminal
npm init -y
npm i express-quickrouter
Sample Code
const express = require('express');
var {newRoute,routes} = require('express-quickrouter')
const app = express();
var route = new newRoute("/","GET",(req,res) => {
res.send("404");
}) // with this, you can copy and add as many routes you want
app.use(route,require("express").Router()); // with this, you can copy and add as many routes you want
app.listen(8000)
ChangeLog Version 1.2.0
Added middleware functioning: Now the route, method, callback and middleware will default to:
{name:"/",
method:"GET",
callback: (req,res) => {res.send("Working")},
middleware: (req,res,next) => {console.log("V"); next()},
}
when no parameters are passed with the
newRoute()
constructer
Changelog Version 1.2.1
BUG WARNING for the newRoute()
constructor.
FOR THE DEFAULT FUNCTIONS TO PASS, AN EMPTY OBJECT {}
MUST BE PASSED OR WILL RETURN AN ERROR.YOU HAVE BEEN WARNED. USE THIS AT YOUR OWN RISK.