C:\Ash\NJS\node_api\app.js:7
server.use(restify.acceptParser(server.acceptable));
^
TypeError: restify.acceptParser is not a function
at Object. (C:\Ash\NJS\node_api\app.js:7:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
what might be the problem? - please help.
`var restify = require('restify');
var server = restify.createServer();
var users = {};
var max_user_id = 0;
server.use(restify.acceptParser(server.acceptable));
server.use(restify.bodyParser());
server.get("/", function(req, res, next) {
res.setHeader('content-type', 'application/json');
res.writeHead(200);
res.end(JSON.stringify(users));
return next();
});
server.post("/user", function(req, res, next) {
var user = req.params;
max_user_id++;
user.id = max_user_id;
users[user.id] = user;
res.setHeader('content-type', 'application/json');
res.writeHead(200);
res.end(JSON.stringify(user));
return next();
});
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
});`