Skip to content

Instantly share code, notes, and snippets.

@fxp
Created December 25, 2016 09:32
Show Gist options
  • Save fxp/cc9134f388cc7d6cc730286430645e67 to your computer and use it in GitHub Desktop.
Save fxp/cc9134f388cc7d6cc730286430645e67 to your computer and use it in GitHub Desktop.
Basic expressjs project
# http://expressjs.com/en/api.html
var app = require('express')();
var bodyParser = require('body-parser');
var multer = require('multer'); // v1.0.5
var upload = multer(); // for parsing multipart/form-data
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.post('/profile', upload.array(), function (req, res, next) {
console.log(req.body);
res.json(req.body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment