Code Monkey home page Code Monkey logo

findit-backend-node's Introduction

Find it Back-end

The Backend application of Find It project.
This application expect a HTTP request from Client Frontend and it returns a JSON with data.

Technologies

In this application the technologies below was used:



alt text

alt text

Setup

Firstly you can clone by using the command below:

git clone https://github.com/BrunoUemura/findit-backend-node.git

Or download the zip file directly from Github and unzip it.

After, downloading open the project direcotiry and run the following commands:

Development environment

Make sure to check the environment variables

  • To install the dependencies npm install
  • To run the database migrations npx sequelize-cli db:migrate
  • To run the project npm run dev

Test environment

Make sure to check the environment variables For testing environment, it is recomended to use docker.

Run the Dockerize Script in bash.

  • To run the dockerize script npm run docker

Production environment

Make sure to check the environment variables

  • To install the dependencies npm install
  • To run the database migrations npx sequelize-cli db:migrate
  • To run the project npm start

How it works

In this API we have several endpoints that is used by the frontend application.
To make HTTP request to the endpoints in this API it is necessary to include /api before each route. The following are the routes and basic instructions to use them.


Swagger API Documentation

Description: Swagger API documentation.
Method: GET
Endpoint: /api-docs \


Users Endpoint

Description: Make a registration (create user).
Method: POST
Endpoint: /api/auth/register
Body:

{
  "name": "Name Lastname",
  "email": "[email protected]",
  "password": "your_password"
}

Description: Make a login (authenticate user).
Method: POST
Endpoint: /api/auth/login
Body:

{
  "email": "[email protected]",
  "password": "your_password"
}

Description: List all the existing users.
Method: GET
Endpoint: /api/users


Description: List one user by its ID.
Method: GET
Endpoint: /api/users/<user_id>


Description: Update user by ID.
Method: PUT
Endpoint: /api/users/<user_id>
Authorization: Bearer Token eyJhbGciOiJIUzI1NiIs...
Body:

{
  "name": "Name Lastname",
  "email": "[email protected]",
  "location": "City, State",
  "phone": "+55 19 99999-9999",
  "occupation": "Software Developer",
  "about_me": "I am a software engineer with experience in backend using Node.js + Express",
  "user_photo": "https://github.com/BrunoUemura.png"
}

Description: Delete a user by ID.
Method: DELETE
Endpoint: /api/users/<user_id>
Authorization: Bearer Token eyJhbGciOiJIUzI1NiIs... \



Services Endpoint

Description: List all the existing services.
Method: GET
Endpoint: /api/services


Description: List a service by its ID.
Method: GET
Endpoint: /api/services/<service_id>


Description: List all the existing services by filter.
Method: GET
Endpoint: /api/services?category=?category=Construction
Endpoint: /api/services?location=?location=Campinas, SP


Description: Create a service passing the following body (Remember to pass an existing user ID in the body).
Method: POST
Endpoint: /api/services/
Authorization: Bearer Token eyJhbGciOiJIUzI1NiIs...
Body:

{
  "user_id": "2e0313fb-fe0f-4dfb-a3e1-df0692762973",
  "title": "Windows Training",
  "category": "IT",
  "description": "I need someone to teach me how to use windows 11",
  "price": "50",
  "location": "Brooklyn, NY"
}

Description: Update an existing service passing the following body (Remember to pass the service id in URL).
Method: PUT
Endpoint: /api/services/<service_id>
Authorization: Bearer Token eyJhbGciOiJIUzI1NiIs...
Body:

{
  "title": "Windows Training",
  "category": "IT",
  "description": "I need someone to teach me how to use windows 11",
  "price": "50",
  "location": "Brooklyn, NY"
}

Description: Delete a service by its ID.
Method: DELETE
Endpoint: /api/services/<service_id>
Authorization: Bearer Token eyJhbGciOiJIUzI1NiIs...


Authors

findit-backend-node's People

Contributors

buemura avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lcsouzamenezes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.