How to host my angular application

2

I have the following directories in my angled application:

node_modules/
src/
--client/
----/app/
----/index.html
--server/
package.json

print the files

I would like that when the user accesses my site he redirect directly to src / client / index.html and hide src / client /.

What is the best way to do this? Thanks.

    
asked by anonymous 27.08.2015 / 04:01

1 answer

4

Using Express on top of NodeJS as the server, you will do the following:

var express= require('express');
var app = express();

app.use(express.static(__dirname + '../client/app'));

app.listen(80, function () {
  console.log('Servidor rodando!');
});

Using express.static , you will tell the server which public folder of your application. The __dirname points to the current folder. In this case, I assumed that your server will stay inside the \server folder and navigated up with the colon and then enter client/app . There, by default, it will "serve" the file with name index .

    
26.11.2015 / 01:50