MMuslimAbdulJ / nodejs-mahasiswa-restfulapi

This is a RESTful API project using Node.js and JWT for Authentication. In this project I tried not to overkill, I wanted to still apply the default Node.js style simplicity but still apply the SoC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Register User

Request :

  • Method : POST
  • Endpoint : api/register
  • Header :
    • Content-Type : application/json
    • Accept : application/json
  • Body :
{
    "username": "string, unique",
    "password": "string"
}

Response :

{
    "message": "User registered successfully"
}

Login User

Request :

  • Method : GET
  • Endpoint : api/login
  • Header :
    • Content-Type : application/json
    • Accept : application/json
  • Body :
{
    "username": "string, unique",
    "password": "string"
}

Response :

{
    "jwt_token": "string"
}

Create Mahasiswa

Request :

  • Method : POST
  • Endpoint : api/mahasiswa/{nim}
  • Header :
    • Content-Type : application/json
    • Accept : application/json
  • Body :
{
    "nim": "string, unique",
    "nama": "string",
    "fakultas": "string",
    "prodi": "string"
}

Response :

{
    "data": {
        "nim": "string, unique",
        "nama": "string",
        "fakultas": "string",
        "prodi": "string"
    }
}

Get All Mahasiswa

Request :

  • Method : GET
  • Endpoint : api/mahasiswa
  • Header :
    • Accept : appliaction/json

Response :

{
    "data": [
        {
            "nim": "string, unique",
            "nama": "string",
            "fakultas": "string",
            "prodi": "string"
        },
        {
            "nim": "string, unique",
            "nama": "string",
            "fakultas": "string",
            "prodi": "string"
        },
        ...
    ]
}

Get Mahasiswa By NIM

Request :

  • Method : GET
  • Endpoint : api/mahasiswa/{nim}
  • Header :
    • Accept : appliaction/json

Response :

{
    "data": {
        "nim": "string, unique",
        "nama": "string",
        "fakultas": "string",
        "prodi": "string"
    }
}

Update Mahasiswa

Request :

  • Method : PUT
  • Endpoint : api/mahasiswa{nim}
  • Header :
    • Content-Type : application/json
    • Accept : application/json
  • Body :
{
    "nama": "string",
    "fakultas": "string",
    "prodi": "string"
}

Response :

{
    "data": {
        "nim": "string, unique",
        "nama": "string",
        "fakultas": "string",
        "prodi": "string"
    }
}

Delete Mahasiswa

Request :

  • Method : DELETE
  • Endpoint : api/mahasiswa/{nim}
  • Header :
    • Accept : application/json

Response :

No Content

About

This is a RESTful API project using Node.js and JWT for Authentication. In this project I tried not to overkill, I wanted to still apply the default Node.js style simplicity but still apply the SoC.


Languages

Language:JavaScript 100.0%