问题
new to node...
const express = require('express');
const bodyParser= require('body-parser');
const MongoClient = require('mongodb').MongoClient;
const app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.set('view engine', 'ejs');
module.exports = function PeopleController() {
function process(req, res, next) {
var baseURL = '/people';
app.get(baseURL + '/?', (req, res) => {
console.log('people get');
});
app.post((baseURL + '/people', (req, res) => {
console.log('people post');
});
}
}
SyntaxError: missing ) after argument list
[nodemon] app crashed - waiting for file changes before starting...
回答1:
You have an unnecessary parenthesis in
app.post((baseURL + '/people', ...);
Replace that with
app.post(baseURL + '/people', ...);
or enclose the first parameter with a closing parenthesis.
app.post((baseURL + '/people'), ...);
来源:https://stackoverflow.com/questions/42288361/node-express-missing-after-argument-list