Giter Club home page Giter Club logo

go-api's Introduction

Pour setup le projet :

  • go

  • une base de données mysql (docker-compose.yml, adminer sur localhost:8080) docker-compose up pour lancer un container mysql

  • Adminer :

    • Systeme : mysql
    • Serveur : db
    • Utilisateur : user
    • Mdp : password
    • Database : goapi
  • Se rendre dans src et lancer go run .

Les endpoints API

Product

  • POST localhost:3333/api/products:
    • fields : name (string), price(float)
    • creation product
  • PUT localhost:3333/api/products/:id
    • id : int
    • update product
  • DELETE localhost:3333/api/products/:id
    • id : int
    • supprime product
  • GET localhost:333/api/products/
    • liste tous les products
  • GET localhost:3333/api/products/:id
    • id : int
    • renvoie le produit demandé

Payement

  • POST localhost:3333/api/payments

    • fields : productid(int), pricepaid(float)
    • creation payment
  • PUT localhost:3333/api/payments/:id

    • fields : productid(int), pricepaid(float)
    • update payment
  • DELETE localhost:3333/api/payments/:id

    • id : int
    • supprime payment
  • GET localhost:3333/api/payments

    • liste tous les payments
  • GET localhost:3333/api/payments/:id

    • id : int
    • renvoie le payment demandé
  • GET localhost:3333/api/payments/stream

    • Header nécessaire :
      • Accept: text/event-stream
  • Commande pour écouter le SSE depuis un terminal : curl -H "Accept: text/event-stream" -N http://localhost:3333/api/payments/stream

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.