我正在尝试使用Express和Angularjs编写带有Node.js的应用程序.
我是否可以允许AngularJS处理所有登陆请求?和Node.js纯粹是用于API?意味着在Node.js中编写的所有路由都是这样的:
app.get('/api/users', users.showAll);
app.post('/api/users', users.create);
app.get('/api/users/fb/:fbId', users.findByFb);
app.get('/api/users/:userId', users.show);
app.put('/api/users/:userId', users.update);
app.del('/api/users/:userId', users.del);
Run Code Online (Sandbox Code Playgroud)
AngularJS能够自己解析URL,例如localhost/users/Some-Name?
将两者结合在一起时,要遵循哪些最佳做法?
另外,是否建议将AngularJS和Node.js应用程序分成两个不同的应用程序?有什么方法可以做到这一点?
提前致谢!!