Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Production build #2

Open
VanQz opened this issue May 24, 2018 · 1 comment
Open

Production build #2

VanQz opened this issue May 24, 2018 · 1 comment

Comments

@VanQz
Copy link

VanQz commented May 24, 2018

ng serve will start the server in development environment but how would i be able to start the server in production environment?

@GuillaumeDeconinck
Copy link
Contributor

To start in prod, you have multiple choices, but it all starts with the following command:
ng build --prod creates a dist directory that contains all the required files in a prod environment.
Those are static files, you can serve them with a FTP server or, for example, with a Node server (like Express, Koa, ...) as static assets.
In fact, anything that can serve static files can be used to serve the website. nginx is also a common choice.

In our case, we use the file server provided with osrts-backend (more precisely thanks to this line: https://github.com/osrts/osrts-backend/blob/master/src/app.js#L45).
We move all the files generated with ng build prod that are inside the dist folder to a public folder inside osrts-backend. The backend server will automatically serve those files.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants