This server is made to be connected with the client of DiscBook and is deployed with Heroku.
- Endpoints to get, post and patch data from the DiscBook Database (by using PostgreSQL and ElephantSQL.
- Sending emails to users with Nodemailer
- Authorization checks with middleware.
- Running server with Express
- Managing the database models and migrations with Sequelize
- Install dependencies
npm install
-
Configure your database in
config/config.json
-
Create database, run migrations & seed data
npx sequelize-cli db:migrate
npx sequelize-cli db:seed:all
- Start your server
npm start
Method | Path | Purpose | Required Parameteres | Auth |
---|---|---|---|---|
GET | '/cds' | Get all CDs in DB | none | no |
POST | '/cds/add' | Add a new CD to DB | album, year, cdCover, userId | yes |
DELETE | /cds/delete/:cdId | Delete a CD from DB | cdId | yes |
PATCH | '/cds/sell/update/:cdId' | Update "forSale" from true to false or otherway around | cdId | yes |
POST | '/email' | Send email to owner of a cd from interested user | senderId, recieverId, album | yes |
GET | 'user/me' | Get user that is logged in | none | yes |
POST | '/login' | Login a user | email, password | no |
POST | '/signup' | Sign up a new user | name, email, password, picture | no |