I would like to deploy my angular application with nodejs, mongo, express js on my own server.
My way is: -> ng build --prod
(output is dist folder) -> ng serve
on dist folder
Start backend: -> node server
js file
But I think, it is not correct way od production stage. Added http server on express, there I create another index html view file with hbs, and there I use:
<body>
<my-app>Loading ...</my-app>
<script src="/dist/bundle.js"></script>
</body>
But on dist server, there is multiple js files.
How can I create using ng option (no webpack or must be fe webpack?) my angular/mongo/node/express application (in 1, my own server, no aws, heroku, github etc). There is any correct way to do it?
I've been able to deploy an angular app using Caddy Server as the webserver.
Create a build of your Angular code by doing ng build --prod-true
. This creates a set of bundled Js and Html files in the dist directory.
Copy these files to where you want to run the app.
Drop the caddy file in the directory that you put your compiled angular code.
Create a caddyfile (just a file named caddyfile), add localhost:(your favorite port number).
No messy node installation. Caddy has all sorts of add-ons to deal with more complicated scenarios but the deployment is caddy.exe, caddyfile and your built code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.