Code Monkey home page Code Monkey logo

api-php's Introduction

API PHP

API simples que tem como recursos usuário, endereço, cidade e estados.

Recursos

Usuário

  • id: Unsigned BigInt
  • nome: String(varchar)
  • endereco_id: Unsigned BigInt
  • cidade_id : Unsigned BigInt
  • estado_id: Unsigned BigInt

Endereço

  • id: Unsigned BigInt
  • logradouro: String(varchar)

Cidade

  • id: Unsigned BigInt
  • nome: String(varchar)

Estado

  • id: Unsigned BigInt
  • abreviacao: String(varchar)

Endpoints

Como não alterei no RouteServiceProvider, por padrão, todos os endpoints do Laravel de api são precedidos pelo prefixo /api.

Usuário

  • Lista de usuários

    GET /api/usuarios/findall.php

  • Usuários por id

    GET /api/usuarios/find.php?id={id}

  • Criar novo usuário

    POST /api/usuarios/create.php

  • Atualizar usuário

    POST /api/usuarios/update.php

  • Deletar usuário

    POST /api/usuarios/delete.php

Endereços

  • Obter endereços

    GET /api/enderecos/findall.php

  • Obter endereço por id

    GET /api/enderecos/find.php?id={id}

Cidades

  • Obter Cidades

    GET /api/cidades/findall.php

  • Obter Cidades por id

    GET /api/cidades/find.php?id={id}

  • Obter total de usuários cadastrados por cidade

    GET /api/cidades/num-usuarios.php

  • Obter total de usuários cadastrados por id da cidade

    GET /api/cidades/{id}/num-usuarios-cidadeid.php?id={id}

Estados

  • Obter Estados

    GET /api/estados/findall.php

  • Obter Estado por id

    GET /api/estados/find.php?id={id}

  • Obter total de usuários cadastrados por estado

    GET /api/estados/num-usuarios.php

  • Obter total de usuários cadastrados por id de estado

    GET /api/estados/{id}/num-usuarios-estadoid.php?id={id}

Testes

Para os testes utilizei o Insomnia rodando no servidor local com:

php -S localhost:8000

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.