website-backend
website-backend copied to clipboard
The backend code for all our website-related apps
Real Dev Squad API
Table of Contents
- About the Project
- Running the Project
- Prerequisites
- API Documentation
- CONTRIBUTING
About the Project
This Project serves the backend APIs required for Real Dev Squad web projects. This project is built in Express.js.
Prerequisites
- The application uses node-config(documentation) for managing config.
- Create a new file:
config/local.js. Override the required config values fromconfig/development.jsandconfig/default.jsintoconfig/local.js. - Register the application for GitHub OAuth to get the
clientIdandclientSecret. Add the callback URL ashttp://<HOSTNAME>:<PORT>/auth/github/callback - Create an application on FireStore and generate a service file. Add the service file credentials in the local config (or your env variables) as a string. Make sure you convert all the escape sequence (newline) -
\nwith\\nin private_key field. - For running the project locally, Firebase Local Emulator Suite can also be used instead of using the remote DB. Steps for setting it up: CONTRIBUTING.md - Using Firebase Emulator Locally
Starting Local Development
Please install yarn and volta
To install Volta, please follow the process
Local Development Setup
Install all the packages using the following command:
yarn
Now if one runs yarn install. The yarn.lock will be unexpectedly updated with an unknown future version of a dependency, potentially breaking the build in the future. To ensure that the yarn.lock file is not update, you will need to use the --frozen-lockfile flag.
yarn install --frozen-lockfile
Confirm correct configuration setup
This command should be successful, before moving to development.
yarn validate-setup
TDD Local Development
Head over to TDD Tests Files List, and add the list of your new (or old) test files.
You can use wildcard '*' in the filepaths
Run TDD in watch mode. Exiting this command will print the coverage report. Try to achieve 100% coverage.
yarn tdd:watch
Running a server in Dev mode
yarn dev
What happens in production:
- Install packages
yarn
- Run tests
yarn run test
- Prune dev dependencies
npm prune --production
- Run start command (with port information)
yarn start
Note: These are handled automatically behind the scene when pushing to Heroku
Check out our video on how to setup the backend here: Wiki link
Read more about contributing to the project: CONTRIBUTING