How to use the express.bodyParser function in express

To help you get started, we’ve selected a few express 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 balderdashy / sails / session_experiment / index.js View on Github external
app.configure(function () {

	// Enable the basic things
	app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.cookieParser());
    
	// Configure Express session store to use connect-redis adapter
	app.use(express.session({
		secret: sessionSecret,
		store: redisSessionStore
	}));
});
github zemirco / ng-signup-form / app.js View on Github external
var express = require('express')
  , http = require('http')
  , path = require('path');

var pass = require('pwd');

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

// redirect to signup form
app.get('/', function(req, res) {
  res.redirect('/signup');
});

// dummy db
var dummyDb = [
github logv / snorkel / snorkel / core / server / main.js View on Github external
// Add timestamps
  require("./console").install();

  app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));

  // Setup authentication
  app.use(express.cookieParser());

  var session = require("./session");
  session.install(app);
  app.use(passport.initialize());
  app.use(passport.session());


  // parse POST request body bits
  app.use(express.bodyParser());


  //app.use(express.logger());
  app.use(express.compress());


  // setup static helpers
  app.use(express.static('app/static'));
  app.use(express.static('core/static'));

  // setup error handling
  //var errorHandlers = require_core("server/error_handlers");
  //app.use(errorHandlers.default);

  // lib
  var routes = require('./routes');
github esanchezm / amazon-cloudwatch-to-slack / app.js View on Github external
/**
 * Module dependencies.
 */

var express = require('express'),
  routes = require('./routes'),
  http = require('http');

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());

// Assemble body.text if we get a POST that has a Content-Typ header of text/plain
app.use(function(req, res, next){
  if (req.is('text/*')) {
    req.text = '';
    req.setEncoding('utf8');
    req.on('data', function(chunk){ req.text += chunk });
    req.on('end', next);
  } else {
    next();
  }
});

app.use(app.router);
github vesparny / angular-kickstart / backend / config / express.js View on Github external
app.configure(function () {
		app.use(express.bodyParser());
		app.use(express.methodOverride());
		app.use(cors);
		app.use(app.router);

		//404
		app.use(function (err, req, res, next) {
			//Treat as 404
			if (~err.message.indexOf('not found')) return next();

			//Log it
			console.error(err.stack);

			//Error page
			res.status(500).send('500', {
				error: err.stack
			});
github matsumotory / mod_mruby / webif / interface / app.js View on Github external
app.configure(function(){
    app.set('views', __dirname + '/views');
    app.set('view engine', 'ejs');
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(__dirname + '/static'));
});
github thesteve0 / fluentwebmap / server.js View on Github external
self.app.configure(function () {
        self.app.use(express.bodyParser());
        self.app.use(express.methodOverride());
        self.app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
  });
github lefnire / derby-auth / example / lib / server / index.js View on Github external
var mongoStore = new MongoStore({ url: dbUri }, function(){

    expressApp
        .use(express.favicon())
        //.use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR}))
        .use(express.compress()).use(express.bodyParser())
        .use(express.methodOverride())
        .use(express.cookieParser())
        .use(store.sessionMiddleware({
            secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE',
            cookie: {maxAge: ONE_YEAR},
            store: mongoStore
        }))
        .use(store.modelMiddleware())

        /**
         * (2)
         * derbyAuth.middleware is inserted after modelMiddleware and before the app router to pass server accessible data to a model
         * Pass in {store} (sets up accessControl & queries), {strategies} (see above), and options
         */
        .use(auth.middleware(strategies, options))
github adrianlee / instagram-realtime-feed / app.js View on Github external
app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'html');
  app.engine('html', require('hbs').__express);
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});
github hakobera / node-freenect / example / simpleviewer / server.js View on Github external
app.configure(function() {
  app.set('views', __dirname + '/views');
  app.use(express.favicon());
  app.use(express.bodyParser());
  app.use(express.cookieParser());
  app.use(express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b]0m :response-time ms' }));
  app.use(express.methodOverride());
  app.use(express.static(__dirname + '/public'));
});