Skip to content

Kratious/CS3219-TaskB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS3219-TaskB

Backend Setup

To setup the backend locally, navigate to the folder packages/back and run:

$ yarn install
$ yarn start

To initialise database, either create a postgres instance that complies with the default connection string in packages/back/src/knexfile.js or edit the default connection string to comply with your preferred postgres instance.

Next, run this command to migrate to latest schema: knex migrate:latest

To seed the database, you can run: knex seed:run

Access the backend endpoints at localhost:5000

Heroku Monorepo Backend Configuration

Create remote for heroku app $ heroku create cs3219-backend --remote heroku-backend

Add heroku-postbuild to packages/back/package.json:

{
    ...,
    "scripts: {
      ...
      "heroku-postbuild": "npm run build"
      ...
    }
    ...
}

Create backend Procfile at packages/back/Procfile:

web: node build/index.js

Configure heroku buildpacks

$ heroku buildpacks:add -a cs3219-backend heroku/nodejs
$ heroku buildpacks:add -a cs3219-backend -i 1 https://github.com/lstoll/heroku-buildpack-monorepo

# set base path for cs3219
$ heroku -a frontend config:set APP_BASE packages/back

# to deploy
$ git push heroku-backend master

Deploy to Heroku

To push changes: $ git push heroku-backend master

To establish seed: $ heroku run knex seed:run --knexfile build/knexfile.js

To run migration: $ heroku run knex migrate:latest --knexfile build/knexfile.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors