Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Where should I assign res.redirect #13

Description

@otogen

Hi, I am a super beginner about Node.js and Express

facebook-template-nodejs example works fine, then I would like to add res.redirect('/AnotherPage') when pushed a button. But I can not get solution. Because your code:

app.get('/',handle_facebook_request);
app.post('/',handle_facebook_request);

I wonder if I should write like as:

function handle_facebook_request(req,res){

if(req.param('button')){
res.redirect('/AnotherPage');
}
....
});

But I think it is wrong. Where should I assign res.redirect?

In case of pushed button, I always write as:

app.post('/', function(req,res){
if(req.param('button')){
res.redirect('/AnotherPage');
}
});

But I am not sure about your example case.

Thank you for your thoughts !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions