我正在尝试使用带有 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);
AngularJS 将能够自己解析 URL,例如 localhost/users/Some-Name?
将两者集成在一起时要遵循哪些最佳实践?
另外,是否建议将 AngularJS 和 Node.js 应用程序分成两个不同的应用程序?有什么方法可以做到这一点?
提前致谢!!