This repo is a for an events platform that a business can use to run events and sell tickets.
A hosted version will be available view Neon.
The database contains tables for users, events, event categories, tickets, event tickets, orders and order items. More details about the project schema can be found (Events Platform Diagram)[/events-platform-plan.pdf].
Ensure you go through the set up instructions first. To start your server run:
npm run start
The server will be running on http://localhost:9090/api/
This url displays all of the endpoints available.
Clone to your own local directory using git:
git clone https://github.com/OJ423/hobby-verse.git
- "bcryptjs": "^2.4.3",
- "dotenv": "^16.4.5",
- "express": "^4.19.2",
- "fs.promises": "^0.1.2",
- "jsonwebtoken": "^9.0.2",
- "nodemailer": "^6.9.15",
- "pg": "^8.12.0"
To seed the database and for unit and integration testing, install the following dev dependencies:
- "jest": "^29.7.0",
- "pg-format": "^1.0.4",
- "supertest": "^7.0.0"
In order to run this project locally. Use dotenv and configure your test and development environments.
- Create file at root level called .env.development
- In this file add - PGDATABASE=hobbyverse
- Create another file at root level called .env.test.
- In this file add PGDATABASE=hobbyverse_test
- Create file at root level called .env.production
- In this file you need to specify your production database address - for example DATABASE_URL=your_database_url
This project uses nodemailer for sending emails, JWT for authentication and Password Reset. In each of your .env files you will need:
- JWT_SECRET="Your Secret Key"
- PASS_REST="A different secret key for - password resets"
- EMAIL_USER="Email address for nodemailer"
- EMAIL_PASS="Email password for nodemailer"
Before seeding the database you may wish to change the database name. The database details can be found in the file called setup.sql
. If you change the database names, ensure that you chance these references in your .env files.
To initialise the test and dev databases:
npm run setup-dbs
Requires PG format installation
In the terminal:
npm run seed
To check you have seeded the database try -
psql
\c your_database
SELECT * FROM events
This should return all events in the database.
If extending functionality or want get a better understanding of the API's functionality, take a look at the __tests__
folder. In order to run tests you will need to have installed jest
, jest-extended
, jest-sortby
and supertest
.
Run tests from the terminal by using -
npm test