serving an angular directory and subsequently using restful API's to load data when needed with nodesj

StackOverflow https://stackoverflow.com/questions/20887645

Question

I am writing my app and I want to do the following:

On the first request, I serve all the client side code (views, models, controllers, css ...) and subsequently I want to do RESTful api calls to the server to populate my app with data.

I've been looking everywhere but can't find a complete example. Connect serves a static directory but after that I don't know how to route RESTful api requests.

Was it helpful?

Solution

I'd recommend that you use Expressjs on top of Connect for request routing: http://expressjs.com/api.html

Its a very straight forward framework, with tons of tutorials online. Here is a good one for getting started: http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top