Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


how do i redirect in expressjs while passing some context


how do i redirect in expressjs while passing some context  using -'node.js,express'

I am using express to make a web app in node.js. This is a simplification of what I have:

var express = require('express');
var jade = require('jade');
var http = require("http");


var app = express();
var server = http.createServer(app);

app.get('/', function(req, res) {
    // Prepare the context
    res.render('home.jade', context);
});

app.post('/category', function(req, res) {
    // Process the data received in req.body
    res.redirect('/');
});


My problem is the following:

If I find that the data sent in /category doesn't validate, I would like pass some additional context to the / page. How could I do this? Redirect doesn't seem to allow any kind of extra parameter.
    

asked Sep 21, 2015 by vimaldas2005
0 votes
13 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...