I'm developing a nodejs application using Restify. The application must serve an API for the application, a static public site based on angular consuming the API and another static, but private, angular site with the administration UI also consuming the API.
I've managed to setup the routes for the public static site and for the API. The Admin is giving me a headache. I need to expose the admin in a different subdomain, something like: admin.mysite.com
, while the api and the public site is served on www.mysite.com
(the api on www.mysite.com/api/
).
This is how i've configured it so far:
// restify route configuration for the public HTML site
server.get(/^\/(?!api)/, restify.serveStatic({
directory: './client/',
default: 'index.html'
}));
// restify route configuration for the API, using directory structure for route setup.
routes(function(routes){
console.log(routes);
routes.forEach(function(route){
server[route.method](route.route, route.handler);
});
});
How can I configure restify to serve, via serveStatic
, admin's HTML UI in a different subdomain on the same nodejs server?