Hiển thị các bài đăng có nhãn Express.js route parameter with slashes. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Express.js route parameter with slashes. Hiển thị tất cả bài đăng

Express.js route parameter with slashes

 https://stackoverflow.com/questions/16829803/express-js-route-parameter-with-slashes

https://stackoverflow.com/questions/10020099/express-js-routing-optional-splat-param

Use /company/:id* (note trailing asterisk).

Full example

var express = require('express')();

express.use(express.router);

express.get('/company/:id*', function(req, res, next) {
    res.json({
        id: req.params['id'],
        path: req.params[0]
    });    
});

express.listen(8080);

This works for /path and /path/foo on express 4, note the * before ?.

router.get('/path/:id*?', function(req, res, next) {
    res.render('page', { title: req.params.id });
});

Suppose you have this url: /api/readFile/c:/a/a.txt

If you want req.params.path to be c::

'/api/readFile/:path*

If you want req.params.path to be c:/a/a.txt:

'/api/readFile/:path([^/]*)'

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...