ACM Purple Team Backend - Splash Pages
Built in Express.js with care by the ACM Side Projects Purple Team. Generate a splash page for your event with all of its details with minimal effort!
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on Heroku.
Requirements
Installing
Get a development environment running.
- Clone the repository to your local machine
git clone https://github.com/acmucsd/purple-team-backend.git
- Navigate to your project directory via terminal
- Run
npm install
to install all dependencies - Rename the example environment file and edit its contents for a testing environment
cp .env.example .env
to rename the example environment file- Edit the contents to reflect the
.env
configuration displayed below
- Run
npm run dev
to boot up your backend server in development mode.- Use
npm start
to regularly launch your backend server. - Use
npm run test
to run unit tests on your routes
- Use
Example .env configuration
NODE_ENV=development
PORT=3000
#MongoDB connection information
MONGO_URI = mongodb_connection_string
You can find the mongodb_connection_string
by going to your MongoDB data cluster, clicking connect
, then the Connect your application
button. From there, there should be a Connection String Only
box that contains your connection string. (Make sure to follow the instructions listed below the box!)
Deployment
- Create a free Heroku account and install the Heroku Command Line interface (CLI).
- Make sure you login to Heroku on your CLI using
heroku login
and following the instructions.
- Make sure you login to Heroku on your CLI using
- Navigate to your project directory using
cd
- Use
heroku create app_name
to create a Heroku application with the name "app_name" (put your application's name here) - Run
heroku buildpacks:set heroku/nodejs
to set the application's build pack. - Install the MLab addon to setup a MongoDB database for your Heroku app with the command
heroku addons:create mongolab:sandbox
- Push your code up to Heroku with
git push heroku master
Now your application should be setup on your Heroku account and is ready for requests!
File Hierarchy
/src
- main folder of the project/src/database
- folder containing everything about the mongoDB database/src/database/models
- folder with all database models/src/routes
- contains all routes
NOTES
- When running tests, mongod will be spun up in memory for easy tests (mongodb-memory-server).
- Otherwise, the app will attempt to connect to the MongoDB database referred to in the .env connection string variable.