I am trying to use node.js to create a program that stores a task, each task is dynamic: such as adding two random number, so I store the task as a jade file, since the second time you called, the random number might be different
The problem I am having right now is that I can write the app.post for each task, but I don't want to do that as there might be ten jade files in that directory, and I have to write app.post for each task ten times, which is not scalable, so I was wondering if there is a way to run all the jade file using one app.post?
Any hint would be appreciated
Use app.get('/:task', do)
for routing and req.params.task
to get the value passed from client.
See http://expressjs.com/api.html#req.params for more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.