Comments (9)
You can deploy to Heroku for example. You need to do some changes:
- create a Procfile file and write
web: node src/server/app.js
- edit package.json and edit
start
script withnode src/server/app.js
- create the bundle using
ng build
orng build --prod
(so you have the dist folder) - upload everything on Heroku
edit:
- you need to remove line 4 of .gitignore
- you need to add a real MongoDB server at line 17 of app.js
from angular-full-stack.
Yes correct. I didn't test it, but it should work.
from angular-full-stack.
Thanks for taking the time to do this @rainstormza! I can verify that it's working for me on Heroku. My .gitignore looked a bit different(I'm probably running a slightly older version) so /dist wasn't on line 4 for me, anyway I removed the reference to /dist and was good to go.
from angular-full-stack.
Did you mean ... if i change
"start": "ng serve --proxy-config proxy.conf.json --open",
to this
"start": "node src/server/app.js",
and use command ng build for create dist folder
then upload app.js and dist folder to heroku server
that's it ?
thanks
I've never used heroku before , so I'm very new for angular 2.
thanks for your help. :)
from angular-full-stack.
It doesn't work :(
look like heroku didn't see index.html in folder dist
Could you please try it for me ?
thanks :)
from angular-full-stack.
Edit .gitignore and remove line 4. Be sure you upload to Heroku also the dist folder.
Also, I forgot to mention before, you need to use a real MongoDB server (eg: mlab.com) if you use Heroku, so you need to edit line 17 of app.js.
from angular-full-stack.
It's work !!!
thanks for your help
I'm writing the solution right now for other people that can use it easier
from angular-full-stack.
How to deployment this project to Heroku
- download source from github file "Angular2-Full-Stack-master"
- use command cd to project and "npm install"
- edit files in project
-file ".gitignore" delete line 4 /dist (now your dist folder can move to heroku server)
-file "package.json" line 9 change to "start": "node src/server/app.js",
-file "app.js" in /src/server/app.js line 17 change to mongo uri "mongodb://:@ds033259.mlab.com:33259/testt" (use mongolab to create database server) - try "ng serve" for testing that everything is ok
- "ng build --prod" for build your dist folder
- cd to your "app.js" path file and run "node app.js"
- log will show connect to mongo and run port 3000
- following heroku Deployment method
- done
from angular-full-stack.
Istructions added to Readme.md. Thank you, closing
from angular-full-stack.
Related Issues (20)
- Error when deploying app to AWS EC2 HOT 3
- list dir tree creation duplicates server folder HOT 1
- Error running dev & prod scripts HOT 1
- body parser package could be removed
- Session Management HOT 3
- JWT token validation is not working HOT 1
- Error while running "npm run dev" command
- After install error HOT 2
- Wildcard instead of controllers?
- How to test the server in Postman HOT 2
- Two mongo connections are opened HOT 4
- Cannot login with prod bundle (working on dev)
- Not able to run on docker compose HOT 2
- How to expose port 80 in production? HOT 2
- Migrate TSLint to ESLint HOT 1
- Fix e2e tests HOT 1
- Update to Angular 12 HOT 1
- Proxy Issue HOT 1
- Upgrade Bootstrap to v5 HOT 3
- Upgrade to Angular v14 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-full-stack.