Backend for StuyActivities.org
- Instal NodeJS on your computer if you haven't done so already: https://nodejs.org/en/download/
- Click the "Use this template" button on GitHub, right of the "Clone or download" button and give your repository a name.
- Clone your new repository to your computer.
cd
into your repository's directory and install dependencies:
npm install
- 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=...
-
Run
npm run migrate
-
Run
npm run authenticate
and follow the instructions in your terminal. YOU MUST USE YOUR STUYSU EMAIL FOR AUTHENTICATION. -
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
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 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/