Coder Social home page Coder Social logo

alvarengaflavio / api-rickandmorty Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 123 KB

CRUD - Rick and Morty

Home Page: https://alva-rickandmorty.herokuapp.com/api-docs/

License: Mozilla Public License 2.0

JavaScript 99.53% Shell 0.47%
bcrypt express heroku-deployment jwt mongodb nodejs

api-rickandmorty's Introduction

API Rick and Morty

This is a CRUD for Rick and Morty characters, with a login system and cryptographic password.
Online Swagger Documentation: https://alva-rickandmorty.herokuapp.com/api-docs/
Heroko git URL: https://git.heroku.com/alva-rickandmorty.git

Setting up

Download the Front-end here.
After the download, unzip and open its folder in Visual Studio Code. Run the following command on terminal:

npm install

After the npm installation, open and modify the file in the path: /api/api.js.
Edit only the line containing the baseURL key, set the following string as value: "https://alva-rickandmorty.herokuapp.com"

export const Api = {
  baseUrl: "https://alva-rickandmorty.herokuapp.com",
  keyJwt: localStorage.getItem("keyLogin"),
  // rest of the code...
}

Run the Front-end with the following command:

npm start

Routes


Users

[POST] - PATH: /users/create

Route responsible for creating a new user. Json example:

{
  "name": "New User",
  "username": "newuser",
  "email": "[email protected]",
  "password": "12345",
  "photo": "https://img-9gag-fun.9cache.com/photo/a3Q5VW5_460s.jpg"
}

[GET] - PATH: /users

Route responsible for getting all users. Response body

{
  "users": [
    {
      "_id": "63c1c2c1e30005318661372cc6",
      "name": "Name of the User",
      "username": "username",
      "email": "[email protected]",
      "photo": "https://myphoto.com/picture/Image-10.jpg",
      "__v": 0
    }
  ]
}

Auth

[POST] - PATH: /auth/login

Route responsible for login users. Request body:

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

Characters

[POST] - PATH: /character/create

Route responsible for creating a new character.

Request body:

{
  "user": "",
  "name": "Rick Sanchez",
  "imageUrl": "https://rickandmortyapi.com/api/character/avatar/1.jpeg"
}

[GET] - PATH: /character

Route responsible for creating new characters Parameters:

  • query
    • limit - Number
    • offset - Number

Response body:

{
  "nextUrl": "/characters?limit=8&offset=8",
  "previousUrl": null,
  "limit": 8,
  "offset": 0,
  "total": 15,
  "results": [
    {
      "id": "63034a0b358f8b1a91516784",
      "user": {
        "_id": "63033c1e3111531881372cc6",
        "name": "Flávio Alvarenga",
        "username": "flaviocode",
        "email": "[email protected]",
        "photo": "https://veja.abril.com.br/wp-content/uploads/2020/09/1-GettyImages-517387700.jpg",
        "__v": 0
      },
      "name": "Morty Smith",
      "imageUrl": "https://rickandmortyapi.com/api/character/avatar/2.jpeg"
    },
    {
      "id": "63034a72358f8b1a91516788",
      "user": {
        "_id": "63033c1e3111531881372cc6",
        "name": "Flávio Alvarenga",
        "username": "flaviocode",
        "email": "[email protected]",
        "photo": "https://veja.abril.com.br/wp-content/uploads/2020/09/1-GettyImages-517387700.jpg",
        "__v": 0
      },
      "name": "Nake Terminator",
      "imageUrl": "https://rickandmortyapi.com/api/character/avatar/577.jpeg"
    }
  ]
}

[GET] - PATH: /character/find/{id}

Route responsible for getting a character by ID. Parameters:

  • path
    • id - String

[PUT] - PATH: /character/update/{id}

Route responsible for updating a character by ID.

Parameters:

  • path

    • id - String
  • body

    • character - Object
{
  "name": "Rick Sanchez",
  "imageUrl": "https://rickandmortyapi.com/api/character/avatar/1.jpeg"
}

[DELETE] - PATH: /character/delete/{id}

Route responsible for deleting a character by ID.

Parameters:

  • path

    • id - String

[GET] - PATH: /character/search

Route responsible for getting characters containing the search term sent via query params. Parameters:

  • query

    • name - String

Schemas

USER

User    {
    name        string
    username    string
    email       string
    password    string
    photo       string
}

CHARACTER

    user        string
    name        string
    imageUrl    string

Language: JavaScript
Tecnology: NodeJs, Express, MongoDB
Workload: 40 hours


api-rickandmorty's People

Contributors

alvarengaflavio 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.