Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

stuysu/api.stuyactivities.org

Repository files navigation

api.stuyactivities.org

Backend for StuyActivities.org

code style: prettier

Quick Start

  1. Instal NodeJS on your computer if you haven't done so already: https://nodejs.org/en/download/
  2. Click the "Use this template" button on GitHub, right of the "Clone or download" button and give your repository a name.
  3. Clone your new repository to your computer.
  4. cd into your repository's directory and install dependencies:
npm install
  1. export all .env variables in your terminal. Please ask one of the IT Directors to send you the .env if you do not have it.
export ENV_VARIABLE1=...
export ENV_VARIABLE2=...
export ENV_VARIABLE3=...
  1. Run npm run migrate

  2. Run npm run authenticate and follow the instructions in your terminal. YOU MUST USE YOUR STUYSU EMAIL FOR AUTHENTICATION.

  3. That's it, you can start developing!

  • If you want your app to automatically restart upon file changes, run it with the following command:
    npm run dev

Databases

The models and migrations are created using Sequelize CLI

Have a database already? You can use it with the app by setting the SEQUELIZE_URL environment varible. You can do this in a .env file like so:

SEQUELIZE_URL=mysql://user:password@localhost/my_db

Otherwise, if the SEQUELIZE_URL env variable is not set, a sqlite database will be created in the root of the app.

Testing

Testing happens with the mocha and chai libraries. By default, mocha will look for tests inside of the test/ directory. You can alter the mocha configuration in the package.json file/