I am working with a facebook application canvas that requires a message. I use express to handle app.post ('/') and app.get ('/') .. is it possible to combine them into one function? Thanks
Besides binding the same function to POST and GET , as suggested by JustSid, in another answer you can use app.all('/', handler) to route all types of requests for work.
POST
GET
app.all('/', handler)
You can have one function for processing both messages and receiving:
function sharedHandler(req, res) { // Some custom logic here } app.get('/', sharedHandler); app.post('/', sharedHandler);