An open API service indexing awesome lists of open source software.

https://github.com/falcao-g/desafio-mega

Projeto back-end do processo seletivo 2023 da MEGA Jr.
https://github.com/falcao-g/desafio-mega

express jwt-authentication postgresql

Last synced: 2 months ago
JSON representation

Projeto back-end do processo seletivo 2023 da MEGA Jr.

Awesome Lists containing this project

README

          

PS Back-end Mega Jr. 2023


Top language
Version express
Version postgres
All contributors

## 📚 Introduction

This repository contains the back-end project for the Mega Jr. Selective Process of 2023.

This project consists of a HTTP API that provides the following functionalities:

- Register a new user
- Login
- Ability to change password, name and upload profile picture
- Get all player items
- See details of one specific item
- Sell an item
- Get all available lootboxes
- Buy and open a lootbox
- Propose a trade with another player
- Accept or decline a trade
- Get all trades
- Cancel a trade

## 🔧 What was used

Authentication

- Bcrypt
- JWT
- httpOnly cookies

Database

- PostgreSQL
- Knex

Tecnologies

- Node.js
- Express

Development

- ESLint
- Prettier
- Husky
- Lint Staged
- Nodemon
- Jest

Image handling

- Multer

Documentation

- Swagger

## 📥 Endpoints documentation

You can find the endpoints, parameters and responses documentation [here](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/falcao-g/processo-mega/main/endpoints.yaml).

## 📝 How to use

### 📦 Prerequisites

- [Node.js](https://nodejs.org/en/download/)
- [PostgreSQL](https://www.postgresql.org/download/)

### 🚀 Running the project

1. Clone this repository
2. Install the dependencies with `npm install`
3. Create a `uploads` folder inside the `src` folder
4. Create a new database in PostgreSQL
5. Remove the `.example` extension from the `.env.example` file
6. Fill the `.env` file with the database information
7. In the `secret` field, you can generate one with `require('crypto').randomBytes(64).toString('hex');"` or use any other string
8. Run the migrations with `knex migrate:latest`
9. Run the project with `npm run dev:start`
10. The server will be running on `http://localhost:8080`! 🎉