Socket
Book a DemoInstallSign in
Socket

express-routes-setting

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-routes-setting

Batch set route methods(GET | POST | PUT | DELETE | ...) for express routing.

latest
npmnpm
Version
1.0.2
Version published
Weekly downloads
1
-97.83%
Maintainers
1
Weekly downloads
 
Created
Source

express-routes-setting

集中设置express路由。

安装依赖包

npm install --save express-routes-setting

使用方法:

  // 完整例子,查看 example 目录。 下面是 example 中 index.ts的示例代码:

  import * as express from "express";
  import { setExpressRouting } from "express-routes-setting";

  var app = express();

  async function index(req: express.Request, res: express.Response, next?: express.NextFunction) {
    console.log(req.method, " /");

    res.send("Hello World");
  }

  async function show(req: express.Request, res: express.Response) {
    console.log(req.method, " /show");

    res.send("ok");
  }

  setExpressRouting(app, [
    { path: "/", method: "get", func: index },
    { path: "/show", method: "get", func: show }
  ]);

  app.use("/home", require("./controller/home"));

  app.listen(3000);

FAQs

Package last updated on 17 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts