0
这是Node.js的如何从URL中获取id作为变量?在Node.js的
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('id: ' + req.query.id);
});
app.listen(3000);
console.log('working...');
//so i need url id as var
var gotID = req.query.id
//want to use this data to another js file
module.exports = gotID;
运行我的快递应用程序,所以我想这个URL id作为我的变量。
这是这个样子URL
http://localhost:3000/[id that i want]
那么,应该怎么办?
我是新来的Node.js加载
好吗谢谢 :) –