Code Monkey home page Code Monkey logo

Comments (9)

DavideViolante avatar DavideViolante commented on May 8, 2024 1

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 with node src/server/app.js
  • create the bundle using ng build or ng 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.

DavideViolante avatar DavideViolante commented on May 8, 2024 1

Yes correct. I didn't test it, but it should work.

from angular-full-stack.

varunity avatar varunity commented on May 8, 2024 1

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.

rainstormza avatar rainstormza commented on May 8, 2024

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.

rainstormza avatar rainstormza commented on May 8, 2024

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.

DavideViolante avatar DavideViolante commented on May 8, 2024

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.

rainstormza avatar rainstormza commented on May 8, 2024

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.

rainstormza avatar rainstormza commented on May 8, 2024

How to deployment this project to Heroku

  1. download source from github file "Angular2-Full-Stack-master"
  2. use command cd to project and "npm install"
  3. 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)
  4. try "ng serve" for testing that everything is ok
  5. "ng build --prod" for build your dist folder
  6. cd to your "app.js" path file and run "node app.js"
  7. log will show connect to mongo and run port 3000
  8. following heroku Deployment method
  9. done

from angular-full-stack.

DavideViolante avatar DavideViolante commented on May 8, 2024

Istructions added to Readme.md. Thank you, closing

from angular-full-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.