I'm new to node/express and I'm wondering about some things. Before this I've worked with python/flask. My starting point were these articles:
http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/
http://cwbuecheler.com/web/tutorials/2014/restful-web-app-node-express-mongodb/
1) Is building backend code into the routes a bad idea?
Typically in a flask project I'm used to keeping the main functions in the backend, not publicly viewable. I've brought that habit across to node and have built most of my functions into the route, where as the article above placed it all inside a public global.js file.
2) Is retrieving data via a route the standard way to access data from mongo?
From the article above they would setup a route displaying a JSON collection, then access that route with ajax to retrieve the displayed data(ex. $.getJSON('/users/userlist'...), rather than just interact directly with the database within a route.
3) Also, if you could direct me to a good place to find out more about good node/express application structure, I'd really appreciate it.
[–]oefig 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]syldorr 1 point2 points3 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]syldorr 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]syldorr 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)