GithubHelp home page GithubHelp logo

micro's Introduction

Lunch the project :

npm i
node app.js

Troll draw the heart ! <3

./bash.bash

Client microservice

Ce projet est un template pour l'implémentation d'un service au sein d'une architecture microservice.

Annuaire

L'annuaire microservice met à disposition les endpoints suivants :

Attention : les endpoints necessitant une authentification de type Token doivent être requetés avec un header nommé "x-auth-token" contenant le jeton qui aura été délivré lors de l'enregistrement.

Enregistrement d'un microservice

Ce endpoint enregistrera votre microservice au sein de l'annuaire à condition que le code soit valide et que le host soit joignable.

Attention, pour pouvoir s'enregistrer, le microservice doit exposer un endpoint GET /ping qui sera appelé régulièrement par l'annuaire afin de vérifier que votre service est toujours disponible. Dans le cas contraire, votre service sera automatiquement supprimé de l'annuaire.

  • URL : ${host_annuaire}/register
  • METHOD : POST
  • AUTHENTICATION TYPE : Basic (Username : ynovset, Password : tHuds4752_525@)

Input :

Type : JSON object

Name Description Type
host Host du microservice (ex : http://192.168.1.23:8080) String
code Identifiant du microservice (ex : john.doe) String

Output :

Type : JSON object

Name Description Type
secret_key Clef privée String
public_key Clef publique String
token Jeton d'authentification String

Response codes :

Status Description
200 Le service a bien été enregistré
400 Un des paramètres obligatoires est manquant
401 Le code du service indiqué est invalide
403 Authentification invalide
500 Erreur inconnue (serveur)
502 Le service ne répond pas à l'adresse GET ${host}/ping

Lister les microservices enregistrés

Ce endpoint permet de récuperer la liste de tous les microservices enregistrés ou en attente d'enregistrement.

  • URL : ${host_annuaire}/registry
  • METHOD : GET
  • AUTHENTICATION TYPE : Token (x-auth-token header)

Input :

Type : None

Output :

Type : JSON array

Name Description Type
host Host du microservice String/null
code Code Code du microservice

Response codes :

Status Description
200 OK
403 Authentification invalide
500 Erreur inconnue (serveur)

Vérifier un token d'authentification

Ce endpoint permet de verifier qu'un jeton d'authenfification .

  • URL : ${host_annuaire}/token/validate
  • METHOD : POST
  • AUTHENTICATION TYPE : Token (x-auth-token header)

Input :

Type : JSON object

Name Description Type
token Token à valider String

Output :

Type : JSON object

Name Description Type
valid Validité du token Boolean

Response codes :

Status Description
200 OK
400 Un des paramètres obligatoires est manquant
403 Authentification invalide
500 Erreur inconnue (serveur)

Déverrouiller un lien avec un microservice

Ce endpoint deverrouille un lien avec un microservice.

  • URL : ${host_annuaire}/key/unlock
  • METHOD : POST
  • AUTHENTICATION TYPE : Token (x-auth-token header)

Input :

Type : JSON object

Name Description Type
code Code du microservice emetteur de la clef String
key Clef fourni par le microservice chiffrée en SHA256 String

Output :

Type : None

Response codes :

Status Description
200 OK
400 Un des paramètres obligatoires est manquant
402 Clef fourni invalide
403 Authentification invalide

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.