Monday, September 1, 2014

use express router and get & post parameters

This article is about make different methods called 'get', 'post'
and all is include all method

and also tell you the way getting paramter ~
I tested all~


var express = require('express');
var router = express.Router();
var fs = require('fs');

/* GET users listing. */
router.get('/', function(req, res) {

    var param1 = req.param('param1');
    console.log(param1);

    var param2 = req.param('param2');
    console.log(param2);

    res.send();

});

router.post('/', function(req, res){
    var param1 = req.param('param1');
    console.log(param1);

    var param2 = req.param('param2');
    console.log(param2);

    res.send();
});

router.all('/all', function(req, res){
    console.log('all');
    var param1 = req.param('param1');
    console.log(param1);

    var param2 = req.param('param2');
    console.log(param2);

    res.send();
});
module.exports = router;

No comments:

Post a Comment