C:\casadocodigo>node app.js C:\ casadocodigo\node_modules\express-validator\lib\express_validator.js:4 const { checkSchema, validationResult } = require('../check'); ^
SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module.compile (module.js:414:25) at Object.Module.extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module.load (module.js:311:12) at Module.require (module.js:366:17) at require (module.js:385:17) at Object. (C:\ casadocodigo\nodemodules\express-validator\index.js:1:80) at Module.compile (module.js:435:26) at Object.Module.extensions..js (module.js:442:10)
código express.js
var express = require('express'); var load = require('express-load'); var bodyParser = require('body-parser'); var expressValidator = require('express-validator');
module.exports = function() {
var app = express();
app.set('view engine', 'ejs');
app.set('views', './app/views');
// use recebe funções na ordem, chamado de meddlewares
// urlencoded({extended: true} modo que o folder é enviado / extended: true = formulário normal
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(expressValidator());
load('routes', {cwd: 'app'})
.then('infra')
.into(app);
return app;
};