API to interface with a Mongo database that stores all the events, projects and people needed for the Core Dumped Website.
- About
- Installation
- Routes
- Usage
- Contributing
- License
- Authors and Contributors
- Code of Conduct
- Changelog
This API connects to a Mongo database and provides access to its data to the Core Dumped Website. It needs to handle GET requests on the Projects, Event and People, accesible to anyone. It needs to allow POST and PUT requests for Projects and Event, only for logged administrators using JSON Web Tokens. It needs to allow PUT requests for People, only for logged administrators using JSON Web Tokens.
Install nodejs 20.5.1 here
Clone this repository and run
npm install
All routes with PUT, POST or DELETE are protected with authentication, use the instructions in the /admin
endpoint to authenticate.
The routes of this API are:
/cartas
GET returns an array of all projects and events sorted by date/cartas
POST creates a new project or event/cartas/[:id]
GET returns a single project or event with the corresponding ID/cartas/[:id]
DELETE deletes a single project or event with the corresponding ID/cartas/[:id]
PUT updates a single project or event with the corresponding ID
/eventos/
GET returns an array of all events sorted by date/eventos/categorias
GET returns an array of all event categories
/proyectos/
GET returns an array of all projects sorted by date/proyectos/categorias
GET returns an array of all project categories
/personas
GET returns an array of all stored people/personas/:id
GET returns a single person with the corresponding ID/personas/:id
PUT updates a single person with the corresponding ID
/login
POST returns a valid for 2h JWT if the password is correct. Apply the password to the headerAuthorization: Bearer <JWT>
/items
GET returns an array of all items/items/:id
resturns the item with the corresponding ID/items
POST creates a new item/items/:id
PUT updates a single item with the corresponding ID/items/:id
DELETE deletes the item with the matching ID
/loaners
POST creates a new loaner/loaners/byid/:id
GET gets loaner with matching ID (Auth protected)/loaners/bymat/:mat
GET gets loaner with matching matricula (Auth protected)/loaners/:id
DELETE deletes the loaner with matching ID/loaners/:id
PUT updates the loaner with matching ID
/loans/:id
GET gets loan with matching ID/loans/item/:id
GET loans associated with item of matching ID/loans/loaner/:id
GET loans associates with loaner of matching ID/loans
POST creates a new loan/loans/:id
DELETE deletes the loan with matching ID/loans/:id
PUT updates the loan with matching ID
To run on dev mode locally
npx nodemon
The API will be hosted in port 3000 if no other port is specified.
First, create a new .env
inside /app
, following the example in .env.example
.
Then run, replacing imageName
and port
docker build -t <imageName> .
docker run -p <port>:3000 <imageName>
We welcome contributions from the community! If you want to contribute to Core Dumped Website API, please follow the guidelines in the CONTRIBUTING.md file.
Core Dumped Website API is released under the Apache 2.0.
Check out the AUTHORS.md file to see a list of all the wonderful people who have contributed to this project.
We expect all contributors to follow our Code of Conduct to maintain a respectful and inclusive environment for everyone.
For a detailed list of changes and versions, check the CHANGELOG.md file.