MEAN stack programming with heroku
Node programming referring to https://www.heroku.com/home .
Partial modification of package.json
If you check the url created at heroku create, the web is created!
Next, try this one using mongo-db.
After actually entering the data, if you look at the sandbox at mlab.com, the data you just entered is saved in json format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone git@github.com: heroku/node-hello.git sushi-inc | |
cd sushi-inc | |
heroku create |
Partial modification of package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git add package.json | |
git push heroku master |
If you check the url created at heroku create, the web is created!
Next, try this one using mongo-db.
- Using mlab, it is necessary to have a credit card registration on heroku. So refering this https://www.webprofessional.jp/building-facebook-chat-bot-node-heroku/ (in the middle of "How to set the database from mLab's site" or https://www.youtube.com/watch?v=cBfcbb07Tqk ), I linked Heroku to mlab.com.
- Process.env.mongodb_uri appears in server.js, but this mongodb_uri seems to be already defined as an environment variable of heroku, so I registered this uri created by mlab to heroku.com.
- Drop the above sample application https://github.com/chrisckchang/mean-contactlist-angular2 (https://devcenter.heroku.com/articles/mean-apps-restful-api ) locally with git clone.
- Remove the app.json because the above app assumes the mlab add-on. (App.json seems to be necessary when using heroku button) (2019.3.3 appending)
Thereis no problem even if app.json remains. - Create an application with "heroku create".
- After selecting the application created above on heroku.com, select "settings", "Reveal Config Vars", set the config Vars (environment variable) to MONGODB_URI and the value to mongodb: // ×× created in the sandbox at mlab.com.
$heroku config: add environment variable = "XXX"
is also ok.
http://blog.ruedap.com/2011/05/03/ruby-heroku-web-app-development-tips-5
- Upload the application to heroku with $git push heroku master.
- Completed when accessing url
After actually entering the data, if you look at the sandbox at mlab.com, the data you just entered is saved in json format.
Comments