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

/* GET home page. */
router.get('/', function (req, res, next) {
    res.render('index', {title: 'ExpressTitle'});
});

router.get('/listUsers', function (req, res) {
    fs.readFile(__dirname + "/data/" + "users.json", 'utf8', function (err, data) {
        console.log(data);
        res.end(data);
    });
});

router.post('/test', function (req, res) {
    res.end('you use post method');
})

module.exports = router;

@@ -57,16 +57,40 @@
 outer();
+%0Avar fs = require('fs');
 %0A%0A/* GET
@@ -258,20 +258,31 @@
     
-fs.readFile(
+let userJsonFilePath = 
 __di
@@ -291,16 +291,23 @@
 ame + %22/
+../bin/
 data/%22 +
@@ -319,16 +319,101 @@
 rs.json%22
+;%0A    console.log('look path: ' + userJsonFilePath);%0A    fs.readFile(userJsonFilePath
 , 'utf8'
@@ -444,16 +444,19 @@
 %0A       
+ //
  console
@@ -514,19 +514,18 @@
 ter.
-pos
+ge
 t('/test
 ', f
@@ -520,16 +520,22 @@
 t('/test
+/:name
 ', funct
@@ -568,33 +568,430 @@
 nd('
-you use post method
+print: ' + req.params.name);%0A%7D);%0A%0Arouter.get('/test', function (req, res) %7B%0A    res.end('print: ' + 'get no other');%0A%7D);%0A%0Arouter.post('/test', function (req, res) %7B%0A    var name = req.body.name;%0A    res.json(%7Bmessage: 'Hello ' + name%7D);%0A%7D);%0A%0Arouter.put('/test', function (req, res) %7B%0A    res.end('print: ' + 'put no other');%0A%7D);%0A%0Arouter.delete('/test', function (req, res) %7B%0A    res.end('print: ' + 'delete no other
 ');%0A%7D)
+;
 %0A%0Amo

test express rest api