Giter VIP home page Giter VIP logo

igma-challenge's Introduction

igma-logo

IGMA - Challenge

๐Ÿ“ Description

This challenge consists in create an REST API to create and retrieve Users. Each user has the following data structure.

	- name
	- cpf
	- birthday

๐Ÿš€ Technologies

๐Ÿš€ Deploy

This project is deployed on Render clound, and can be connected and tested using the following link: https://igma-challenge.onrender.com

Disclaimer: The first request is a little longer than others. It happen because the server automatically spun down after 15 minutes of inactivity, and then the first request "wakes up" the server. See more information here

In case you want to install and test the application locally follow the next steps

๐Ÿ“ฆ Installation

Clone the repository.

# https
$ git clone https://github.com/frreiro/igma-challenge
# ssh
$ git clone [email protected]:frreiro/igma-challenge.git

Install the dependencies.

$ cd igma-challenge && npm install
#or
$ cd igma-challenge &&  yarn

๐Ÿš€ Usage

This project required three enviroments files

  • .env
  • .env.docker
  • .env.test

To create those enviroments, just follow the instructions in the following files:

  • .env.example
  • .env.docker.example
  • .env.test.example

Development mode

To run the project in development mode, create a .env file based on the .env.example file and run the following command:

$ npm run start:dev
#or
$ yarn run start:dev

Make a request for http://localhost:<PORT>/<ROUTE>, PORT was defined by you in .env and ROUTE see below for more informations

Docker mode

To run the project in docker mode, create a .env.docker file based on the .env.docker.example file and run the following command:

$ npm run docker:up
#or
$ yarn run docker:up

Make a request for http://localhost:<PORT>/<ROUTE>, PORT was defined by you in .env and ROUTE see below for more informations

Tests mode

To run the tests of the project in docker, create a .env.test file based on the .env.test.example file and run the following command:

$ npm run docker:up:test
#or
$ yarn run docker:up:test

๐Ÿ“Œ Features

  • Create user
  • Read all users
  • Read all users by page
  • Read users by cpf

๐Ÿ”€ Routes

  • POST /users - Create a new User

    • headers: default

    • body:

      {
      	"name": "yourname",
      	"cpf": "XXXXXXXXXDD",
      	"birthday": "YYYY-MM-DDTHH:mm:ss",
      }

      Thoses three types of body cpf property are accepted:

      property type example obligation
      cpf number 12345678910 must be a valid cpf
      cpf string '123.456.789-10' must be a valid cpf
      cpf string '12345678910' must be a valid cpf
    • response:

      	{
      		"id": 0,
      		"name": "yourname",
      		"cpf": "XXXXXXXXXDD",
      		"birthday": "YYYY-MM-DDTHH:mm:ss",
      	}
  • GET /users - Get all users, limit 5 users by page

    Query Params type value Description
    none none null first page
    page number 0 first page
    page number 1 first page
    page number > 1 pagination
    • headers: default
    • body: none
    • response:
      [
      	{
      		"id": 0,
      		"name": "yourname",
      		"cpf": "XXXXXXXXXDD",
      		"birthday": "YYYY-MM-DDTHH:mm:ss",
      	}
      ]
  • GET /users/:cpf - Get user by cpf

    • headers: default
    • body: none
    • response:
      {
      	"id": 0,
      	"name": "yourname",
      	"cpf": "XXXXXXXXXDD",
      	"birthday": "YYYY-MM-DDTHH:mm:ss",
      }
  • GET /health - Get API health

    • headers:
    • body: none
    • response: OK

๐Ÿ’ฝ Database

This project uses a PostgreSQL database.

  • Database name: igmadb
  • Tables:
    • users: Stores all users

igma-challenge's People

Contributors

frreiro avatar

Watchers

 avatar

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.