Routes with AngularJS and Node.js

0

I learned a little about AngularJS and now I'm starting with Node.js and some doubts have arisen. With the Angular I use $routeProvider to create the routes and to navigate between the pages as a single page application, in the Node I was also able to use the routes, but the question arose as to how to use the two or if, using angular and node, I should use the routes in one or the other.

I read several things and from what I saw, I should use the routes by node only, is that right?

    
asked by anonymous 15.06.2016 / 18:49

2 answers

2

War, $ routeProvider is only used on the front end and serves to navigate between pages. With it you can define the controller and layout of each page.

The nodejs is a server (backend). The routes you create in Express are REST services and you can make requests for these services through $ http from the angle.

    
14.09.2016 / 17:42
1

The right thing is to use only the node,

With Express you will probably want to capture all the requests and send them to your index.html example:

app = express();
app.use(app.router);
app.use(function(req, res) {
  res.sendfile(__dirname + '/public/index.html');
});

font

    
15.06.2016 / 19:48