GithubHelp home page GithubHelp logo

adwiarifin-nodemicro's Introduction

README

This project is to learn and prove the concept nodejs and microservices. This project build with Node.js with MongoDB as database, and Redis as caching layer. To secure resource i'm using jsonwebtoken.

List Endpoint

  • GET /health
    To check if service is up or not
  • POST /api/auth/token
    To generate dummy token, no body required
  • GET /api/auth/token
    To check / verify if token is valid. insert authorization on headers.
    headers:
      Authorization: Basic xxxxx
    
  • GET /api/user
    To get list of user. Need Authorization.
    Other option can be used via query params.
    GET /api/user?account_number=xxx
    GET /api/user?identity_number=xxx
    
    Example:
    {
      "status": 200,
      "data": [
        {
          "_id": "609832c8b20faf0003838617",
          "id": "21cd1aff-71c1-41b2-b6de-7ffa47358cf9",
          "user_name": "johndoe",
          "account_number": "1234",
          "email_address": "[email protected]",
          "identity_number": "1234",
          "__v": 0
        }
      ]
    }
    
  • POST /api/user
    To create / store new user.
    Example Request:
    {
      "user_name": "johndoe",
      "account_number": "1234",
      "email_address": "[email protected]",
      "identity_number": "1234"
    }
    
    Example Response:
    {
      "status": 200,
      "data": [
        {
          "_id": "609832c8b20faf0003838617",
          "id": "21cd1aff-71c1-41b2-b6de-7ffa47358cf9",
          "user_name": "johndoe",
          "account_number": "1234",
          "email_address": "[email protected]",
          "identity_number": "1234",
          "__v": 0
        }
      ]
    }
    
  • GET /api/user/:id To get single user, id that be used is id with format uuid. ex: 21cd1aff-71c1-41b2-b6de-7ffa47358cf9
    Example:
    {
      "status": 200,
      "data": {
        "_id": "609832c8b20faf0003838617",
        "id": "21cd1aff-71c1-41b2-b6de-7ffa47358cf9",
        "user_name": "johndoe",
        "account_number": "1234",
        "email_address": "[email protected]",
        "identity_number": "1234",
        "__v": 0
      }
    }
    
  • PUT /api/user/:id
    To update data user.
    Example Request:
    {
      "user_name": "johndoe",
      "account_number": "1234",
      "email_address": "[email protected]",
      "identity_number": "1234"
    }
    
    Example Response:
    {
      "status": 200,
      "data": [
        {
          "_id": "609832c8b20faf0003838617",
          "id": "21cd1aff-71c1-41b2-b6de-7ffa47358cf9",
          "user_name": "johndoe",
          "account_number": "1234",
          "email_address": "[email protected]",
          "identity_number": "1234",
          "__v": 0
        }
      ]
    }
    
  • DELETE /api/user/:id
    To Delete user data.

Real Example

Link

adwiarifin-nodemicro's People

Contributors

adwiarifin avatar

Watchers

James Cloos avatar  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.