Heroku
Table of Content
Introduction
Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. (heroku docs)
- Started in 2007
- They handle 26+ billion requests per day
- Good security/easy to scale
- Low config
- Free options
Heroku dashboard
Create new app
- click on create new app
- go to settings
- add buildpack and select nodejs
Custom url
CLI
Install heroku on a project
Heroku instructions link (Heroku cli instructions)
Instructions summary
- install npm package globally
- login with heroku
- Add heroku remote to project
- push to heroku master
git push heroku master
Optionally we could add the post build script and a port to the 'start' script
Post build
This command is run after a build in heroku
{
"scripts": {
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
}
}
Add custom domain
- set billing information (you dont get charged)
- go to project ./example-project
- run next script
heroku domains:add www.example.com -a heroku-example-project-name
- configure dns provider