Skip to content

Latest commit

 

History

History
77 lines (66 loc) · 2.05 KB

README.md

File metadata and controls

77 lines (66 loc) · 2.05 KB

CS458 Backend Server

Check product documentation for more details.

Installation

  1. Fork this repo
  2. Click on Code and copy the url
  3. Run the following commands:
# Replace FORK_URL with what you just copied
git clone FORK_URL
cd backend

1. Install app dependencies

yarn install

or

npm install

yarn is the recomended package manager. Therefore, next instructions will be demonstrated via yarn. You can install it with this guide.

2. Setup the environment file

echo "JWT_SECRET='SECRET_KEY'" >> .env

For the rest of the environment variables, check this file.

3. Start the container

yarn container:start

Now, you should see the server ready message:

web | 🔷 NODE_ENV: development
web | 🚀 Server ready at http://localhost:5000
web | Executing (default): SELECT 1+1 AS result
web | 📚 Database connection has been established successfully

4. Setup database

In a separate terminal, run:

yarn container:setup

You should see:

>>> DB SETUP COMPLETE!

All set! Go to http://localhost:5000/ -- you should see:

{
  status: 1
}

5. Create a database model

yarn sequelize-cli model:generate --name Sample --attributes name:string,surname:string,email:string
yarn sequelize-cli seed:generate --name Sample

You can use the link for the data types of sequelize.

6. Deploy

  • All set! Go to heroku dashboard -- you should see list of your apps.
  • Open the control panel of the app that corresponding to qrder_web project.
  • Enter to the Settings menu.
  • Setup Config Vars of the project properly. For details
  • Enter to the Deploy menu.
  • Check whether automatic deploy is enabled. -- if not:
    • Choose a branch that you want to deploy to heroku and press Enable Automatic Deploys button. Or,
    • Use the Manual deploy option.