How to use the body-parser.urlEncoded function in body-parser

To help you get started, we’ve selected a few body-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MennaDarwish / DSP / routes / editCreative.js View on Github external
var express = require('express');
var bodyParser = require('body-parser');
var urlEncoded = bodyParser.urlEncoded({
	extended: false
});
var Creative = require('..models/index.js').Creative;
router = express.Router();


router.route('/:id')
	.put(urlEncoded, function(req, res) {
		Creative.find(req.params.id).then(function(oldCreative) {
			if (!oldCreative) res.sendStatus(404);
			oldCreative.setDataValues('height', req.body.height);
			oldCreative.setDataValues('width', req.body.height);
			oldCreative.setDataValues('redirectUrl', req.body.redirectUrl);
			oldCreative.setDataValues('imageUrl', req.body.imageUrl);
			oldCreative.setDataValues('microUSD', req.body.microUSD);
			oldCreative.save();

body-parser

Node.js body parsing middleware

MIT
Latest version published 2 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages