Backend server for film lottery project. Written with Node.js and Express. Uses MongoDB as a database and 'The Movie Database' as a movie repository.
Before running this project you will need to :
- Setup a database cluster in MongoDB
- Setup an API key for The Movie Database
- Setup secret tokens for authentication
- Setup an .env file
- Follow the instructions here to setup a new db
- Keep a record of your connection string, username and password for this db
- Setup the follwing databases and collections:
- Database: 'auth', collection: 'users'
- Database: 'local_development', collection: 'lists'
- Create an account for TMDB here
- Login
- Follow the link on this page to get an API key
- Keep a record of your API key
- In a terminal window run the following
node
- Then run:
require('crypto).randomBytes(64).toString('hex')
- Exit node session with: Ctrl + C
- Copy the resulting string. You will need to repeat this process 2 times.
In the root of the repository add an .env file with the following keys:
PORT= '' #port number to run this project
FRONTEND_URL='http://localhost:<PORT for frontend>'
MONGO_URI='' #the end of your datbase connection string (everything after '@' symbol)
MONGO_USERNAME='' #your mongo username
MONGO_PASSWORD='' #your mongo password
MOVIE_DB_KEY='' #your tmdb api key
ACCESS_TOKEN='' #first key generated in the above step
REFRESH_TOKEN='' #second key generated in the above step
You will need some of the keys in this file to run the front-end of this project
To run the project locally:
npm install
npm start
Once you have successfully run this repository you can follow instructions to run the front-end here