Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ JWT_INVITE_SECRET=<some other secret key>
#Reset password secret
JWT_RESET_PWD_SECRET=<yet some other secret key>

#Secret key fo account confirmation token
#Secret key for account confirmation token
JWT_CONFIRM_ACC_SECRET=<yet another secret ket part 2>

#mail information
Expand All @@ -53,3 +53,7 @@ AUTH_URI=<auth uri>
TOKEN_URI=<token uri>
AUTH_PROVIDER_X509_CERT_URL=<auth provider>
CLIENT_X509_CERT_URL=<client cert url>

# Google Sheets checkin form
SPREADSHEET_ID=<checkin spreadsheet id>
CHECKIN_SHEET_NAME=<checkin spreadsheet name>
42 changes: 25 additions & 17 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,39 @@

* A google cloud provider account:
* Google storage bucket.
* Sendgrid account and the sendgrid_api_key
* Sendgrid account:
* Sendgrid API key. You may need to log in to the Sendgrid account and create a new key.

## Setting up this repo

1. Clone the repository: `git clone https://github.com/hackmcgill/hackerAPI.git`
2. Make sure you have the following tools:
1. `git`: <https://git-scm.com/downloads>
2. `mongodb`: <https://docs.mongodb.com/manual/installation/>
1. Make sure you also have the `/data/db` directory.
2. To test the installation, run `mongod`.
3. `node`: <https://nodejs.org/en/download/>
4. `npm`: <https://www.npmjs.com/get-npm>.
5. `Postman`: <https://www.getpostman.com/downloads/>. We use this for testing the API locally.
3. Make sure you have the following (only if you are going to be publishing this as a kubernetes cluster on google cloud):
1. `kubectl`: <https://kubernetes.io/docs/tasks/tools/install-kubectl/>
2. `gcloud`: <https://cloud.google.com/sdk/install>
4. Create a `.env` file in the root directory, and populate the fields as per `.env.example`.
5. run `npm install`
2. Make sure you have [node **v20.10.0**](https://nodejs.org/en/download/) installed. You can check using `node -v`.
* It is recommended to install and use [node version manager (nvm)](https://www.nvmnode.com/guide/download.html) as other McHacks repos may not use the same version of node.
* If you have another standalone version of node installed, uninstall it or make sure that your shell calls the node from nvm and _not_ the standalone one.
* Run `nvm install 20.10.0`
* If you want your default node version to be a different version, you can install that version and follow instructions [here](https://www.nvmnode.com/guide/usage.html#setting-a-default-node-js-version)
* The .nvmrc file should automatically have nvm use 20.10.0 when you execute node commands in this folder
2. Make sure you have [MongoDB Community edition](https://www.mongodb.com/try/download/community) installed.
* Follow the setup instructions for your operating system at <https://www.mongodb.com/docs/manual/administration/install-community/>. Keeping all the default values provided by the installer should be fine.
* Start the mongodb service if it was not started during installation.
* You can check if it installed properly by running `mongod --version` as well as `mongosh`.
3. Create a `.env` file in the root directory, and populate the fields as per `.env.example`.
* Most values can be found in the 1Password, including the dev and deploy database information, JWT and cookie secrets, and Google Cloud service account information.
* The test database should be a local database.
* See previous section for `SENDGRID_API_KEY`.
* `NO_REPLY_EMAIL` should be the McHacks noreply email.
* `SPREADSHEET_ID` and `CHECKIN_SHEET_NAME` shoud have the corresponding information for the Google Sheets spreadsheet that is connected to the team check-in form.
4. Run `npm install` to install all the dependencies.
5. Set up the database using instructions in the next section.
6. Run `npm run start` or `npm run start-windows` to serve locally!


## Setting up the database

1. Determine which environment the database you want to seed belongs to (`deployment`, `development`, or `test`).
2. Navigate to `package.json`, and confirm that at the `seed` script, `NODE_ENV` is set to the proper environment.
3. Run `npm run seed`.
2. Navigate to `package.json`, and confirm that at the `seed` and/or `seed-windows` script, `NODE_ENV` is set to the proper environment.
3. Run `npm run seed` or `npm run seed-windows`.

## Testing the API

In order to test that you have set up the API properly, run `npm run test`.
In order to test that you have set up the API properly, run `npm run test`.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"private": true,
"scripts": {
"start": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js",
"start-windows": "set DEBUG=hackboard:* && set NODE_ENV=test && nodemon --ignore gcp_creds.json ./bin/www.js",
"start-windows": "set \"DEBUG=hackboard:*\" && set \"NODE_ENV=development\" && nodemon --ignore gcp_creds.json ./bin/www.js",
"deploy": "NODE_ENV=deployment node ./bin/www.js",
"debug": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js",
"test": "DEBUG=hackboard:* NODE_ENV=development mocha -r dotenv/config --reporter spec tests/**.js --exit",
"test-windows": "DEBUG=hackboard:* SET NODE_ENV=development & mocha -r dotenv/config --reporter spec tests/**.js --exit",
"test-windows": "DEBUG=hackboard:* SET NODE_ENV=test & mocha -r dotenv/config --reporter spec tests/**.js --exit",
"seed": "NODE_ENV=development node ./seed/index.js",
"seed-windows": "set \"NODE_ENV=test\" && node ./seed/index.js",
"docs": "apidoc -i ./routes -o ./docs/api/",
"format": "prettier --write '**/*.js'",
"lint": "eslint --fix '**/*.js'"
Expand Down
Loading