Hey there! I started off by creating a question about passing over data using the GET method, but now I'm facing a new problem when trying to pass over data with the POST method. Below is my code snippet where things seem to be going wrong. My goal is to display: "Hello (Whatever the user passes as their name)!" If ExpressJS isn't working, can someone guide me on how to achieve this in JavaScript?
Check out the code below:
var server = require('./server');
var router = require('./router');
var requestHandlers = require('./requestHandlers');
var handle = {
'/': requestHandlers.start,
'/start': requestHandlers.start,
'/upload': requestHandlers.upload,
'/show': requestHandlers.show
};
var express = require('express')
var app = express()
app.post('/view/users/:name', function(req, res) {
console.log(req.body.desc);
res.end();
});
app.listen(8080, function () {
console.log('listening on port 8000!')
})
When I try to pass over data, I encounter the error message "Cannot GET /view/users/John"