DEV Community

Discussion on: Build a Todo App with Node.Js, ExpressJs, MongoDB and VueJs – Part 1

Collapse
 
unika profile image
unika • Edited

Hi Samuel!

I followed your first part of the tutorial, but my curl request didn't work.
And my app didn't work, but my IDE didn't produce me any mistakes...

UPDATE

You missed the code:

app.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(server is listening on ${port})
})

My app works with it.

UPDATE

This: curl -H "Content-Type: application/json" -X POST -d '{"name":"Going Shopping"}' localhost:4000/api/add

Show me this:

Unexpected token ' in JSON at position 0

Please, could you help me with it?

Collapse
 
abiodunjames profile image
Samuel James • Edited

Hello Unika,

Sorry for my late response. Use this:

curl -X POST -H "Content-Type: application/json" \
-d "{\"name\":\"Going shopping\"}" http://localhost:4000/api/add