I'm writing a simple api for training using express
. Here's my testing code:
var express = require('express');
var app = express();
app.post("/api/:var_name", function(req, res) {
res.send(req.params.var_name);
});
is simply testing to see if POST
is working. When I call http://localhost:3000/api/1
I get Cannot GET /api/1
, so the server is obviously interpreting the POST
request as GET
, what do I need to do to call POST
instead?