Node.js Provider Rest API and angular.js WEB APP

I'm developing an Rest API in Node.js / express to expose resources (to Backend). And another web application that manages Sessions and interacts with the Rest API (to Frontend). API and WEB_APP, is in same domain, with subdomain in both:

  • Backend: api.example.com
  • 2 Frontend: www.example.com

The web application is accessed from client with angular.js.

The architecture would be for two situations:

Main_Rest_API <-> WEB_APP <-> Browser_User
Main_Rest_API <-> Rest_SDK <-> Client

My question is: This architecture is consistent? What would be the best way to implement this scheme?

Update:

I have to implement this architecture to provide Restfull via OAuth2 to third-party clients also

I don't really understand your question,

are you sure that you need separate servers for serving the web app and for the API? you'll need to handle cross domain requests this way.

if you don't actually need two servers, it'll be simpler to have one app, where /api/ routes (for example) are the REST API. then your AngularJS app can make AJAX requests to /api/ and / will serve the JavaScript web app.

again, I don't understand your question for the case you do need two separate servers.