📌  相关文章
📜  解释 router.get(" :id(\\d+) - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:41.059000             🧑  作者: Mango

代码示例1
let express = require('express');
let app = express();

app.get('/api/Widgets', (request, response, next) => {
    // Business logic goes in here...
    // then we send something in the response, maybe some JSON!
    response.json({ widgets: [ { id: 1, name: 'foo' }, { id: 2, name: 'bar' } ] });
    // Note that we DO NOT all next() unless we want another route to also fire (usually we do not).
});

app.listen(3000);