samedi 9 mai 2015

Thinkster MEAN Stack Tutorial problems with routing

I have been following this tutorial on thinkster.io:

http://ift.tt/1IXiNVv

Everything works fine until I get to the section where we setup mongoose, then I start to hit problems.

First of all in the section "Creating Schemas with Mongoose" it says:

"Connect to our local MongoDB instance by adding the following code into our app.js file:"

But this is unclear - what do they mean by "our" app.js file - we no longer have an app.js that we created as we renamed it to angularApp.js - the only app.js file is the one generated by express/npm which is in the /views/ folder and is full of express configurations. I personally added the code to this file but am unsure if they meant for us to add it to /public/javascripts/angularApp.js

Secondly, in the "Creating our first route" section, the tutorial instructs us to add the code to routes/index.js but again this file is already populated with express routes and the tutorial is unclear as to whether we append this file with the new route for /posts or to remove the existing express route and add the /posts route instead.

Either way, the result is when I attempt to post the first data to mongodb via curl or postman it results in a 404, indicating the route is not working.

Any help appreciated - there is no comment section on the site for asking questions or troubleshooting, so I am hoping stackoverflow can fill in the gaps :)

Aucun commentaire:

Enregistrer un commentaire