Skip to content

Latest commit

 

History

History
executable file
·
114 lines (80 loc) · 3.12 KB

README.md

File metadata and controls

executable file
·
114 lines (80 loc) · 3.12 KB

Badge em Desenvolvimento

GitHub contributors GitHub discussions GitHub issues GitHub pull request

This readme can also be read in Portuguese or English.

Delivery API

This is the backend of the delivery system, developed in Node.js, Express, Typescript, Prisma ORM with PostgreSQL and Swagger for API documentation.

Project Structure

  • src/controllers: Contains route controllers.
  • src/repositories: Contains the repositories to interact with the database.
  • src/services: Contains the services that implement the business logic.
  • src/http/server.ts: Express server input file.
  • src/http/routes/index.ts: Contains the application routes.

API documentation

Full API documentation can be accessed at http://localhost:5555/api-docs after starting the server. Documentation is generated using Swagger.

Requirements

  • Node.js Version >= v20.0.0
  • PostgreSQL
  • pnpm ou npm
  • Docker

Run Locally

  1. Clone the repository:
git clone https://github.com/ThiLourenco/delivery-backend.git
cd delivery-backend
  1. Install dependencies:
pnpm install
or
npm install
  1. Installation with Docker-Compose:

This repository contains the artifacts necessary to run using Docker. First of all, you will need to install some prerequisites, if they are not already installed:

  docker compose up
  1. Configure the PostgreSQL database and create a .env file in the project root with the database URL:
DATABASE_URL=postgresql://<user>:<password>@<host>:<port>/<database>?schema=public
  1. Run Prisma migrations to create the tables in the database:
npx prisma migrate dev --name init
  1. Generate the Prisma client:
npx prisma generate

Running the Server

To start the server in development mode, use:

pnpm dev
or 
npm run dev

The server will start at http://localhost:5555 or your preferred port.

Running tests

pnpm test
or 
npm run test

Contribution

If you want to contribute to this project, follow the steps below:

  1. Fork the repository.
  2. Create a branch for your feature (git checkout -b my-feature).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin my-feature).
  5. Create a new Pull Request.

Contributors

License

This project is licensed under the MIT License - see the MIT License file for details.