Skip to content

Instantly share code, notes, and snippets.

@lastday154
Forked from evenchange4/step.md
Last active December 3, 2017 01:49
Show Gist options
  • Save lastday154/14b30cc126f488f3f4bb0df7e4fdb79b to your computer and use it in GitHub Desktop.
Save lastday154/14b30cc126f488f3f4bb0df7e4fdb79b to your computer and use it in GitHub Desktop.
Deploy a Express.js project on Heroku

Deploy a Express.js project on Heroku

Step by step from command line by Steve Tuan

Quick start

Change app.js to dynamic port

const PORT = process.env.PORT || 3000
app.listen(PORT, () => console.log(`Example app listening on port ${PORT}!`))

Declare process types with Procfile

web: node app.js

Configure database MongodDb(mlab) - Mysql(JawsDb through sequelPro)

  • MongoDb: change url provided by Mlab
  • Mysql: host, user, password

Git

$ git init
$ git add .
$ git commit -m "init"

Create Heroku app

$ heroku create myfirstexpress

Deploy on Heroku

$ git push heroku master

Open

$ heroku open
http://myfirstexpress.herokuapp.com/

Reference

Getting Started with Node.js on Heroku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment