javascript – node.js server not responding, and not running
I’m pretty new to node and I’m trying to create a simple server for iOS notes app but when I type in node server.js in command prompt nothing happens.
`
//CREATE A NOTE
//Post request
app.post("/create", (req, res) => {
var Note = new Data({
note: req.get("note"),
title: req.get("title"),
date: req.get("data"),
})
note.save().then(() => {
if (note.isNew == false){
console.log("Save data!")
res.send("Saved data")
}else {
console.log("Failed to save data")
}
})
})
// http://10.11.210.1:8081/create
var server = app.listen(8081, "10.11.210.1", function(){
console.log("Server is running!")
})
Read more here: Source link