native

最精简restful实现

总计 229 字
Time is short. Just show me the code! var http = require('http'); var url = require('url'); var items = []; /* 附上测试方法 curl -X GET http://localhost:3000 curl -X POST -d "Node should test in action" http://localhost:3000 curl -X DELETE http://localhost:3000/1 curl -X PUT -d "Pratice node every day" http://localhost:3000/1 */ var server = http.createServer(function (req, res) { // method include POST,GET,DELETE,PUT switch (req.method) { case