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("https://stackoverflow.com/", 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("https://stackoverflow.com/");
});

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.

10 Answers
10

Leave a Reply

Your email address will not be published. Required fields are marked *