GithubHelp home page GithubHelp logo

wahyupambudi / binar-algorithm-fsw-mock-test Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 433 KB

Mock Test Algoritma Basic Binar Backend Academy

JavaScript 100.00%
backend-api binar express-js jwt-authentication prisma-orm railway-app todo-list

binar-algorithm-fsw-mock-test's Introduction

BINAR ALGORITHM BACKEND MOCK TEST

Algorithm Test

Algorithm Mock tes on Folder algorithm-test

Project Todolist API

This is my project Backend API Todolist with tech stack nodeJs, ExpressJs, Postgres

The module nodejs used are in package.json file.

index.js used to run the service

ERD

App Screenshot

Install module nodejs

npm install

Migrate Database with prisma

npx prisma migrate dev

Run the app

npm run start

REST API

The REST API to the todolist app is described below.

Auth - Registration

Request

POST /api/v1/auth/register HTTP/1.1
Content-Type: application/json
Host: binar-algorithm-fsw-mock-test-production.up.railway.app
Content-Length: 69

{
	"name": "user",
	"email": "[email protected]",
	"password": "123123"
}

App Screenshot

Auth - Login

Request

POST /api/v1/auth/login HTTP/1.1
Content-Type: application/json
Host: binar-algorithm-fsw-mock-test-production.up.railway.app
Content-Length: 52

{
	"email": "[email protected]",
	"password": "123123"
}

You will get a token that will be used to get authorization to perform CRUD todolist

App Screenshot

Auth - Whoami

Request

GET /api/v1/auth/whoami HTTP/1.1
Authorization: yourAuthorization (token from jwt)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app

App Screenshot

Auth - Logout

Request

POST /api/v1/auth/logout HTTP/1.1
Authorization: yourAuthorization (token from jwt)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app

App Screenshot

Todolist - Get

Request

GET /api/v1/todo HTTP/1.1
Content-Type: application/json
Authorization: yourAuthorization (token from jwt)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app

App Screenshot

Todolist - Insert

Request

POST /api/v1/todo HTTP/1.1
Content-Type: application/json
Authorization: yourAuthorization (token from jwt)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app
Content-Length: 176

{
	"task": "binar user",
	"description": "pembahasan tentang media handling",
	"start": "2023-11-22T08:09:59.908Z",
	"finish": "2023-11-22T08:09:59.908Z",
	"status": "proses"
}

App Screenshot

Todolist - Update

Request

PUT /api/v1/todo/3 HTTP/1.1
Content-Type: application/json
Authorization: yourAuthorization (token from jwt)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app
Content-Length: 177

{
	"task": "belajar binar update",
	"description": "pembahasan tentang media",
	"start": "2023-11-22T08:10:48.451Z",
	"finish": "2023-11-22T08:10:48.452Z",
	"status": "proses"
}

App Screenshot

Todolist - Delete

Request

DELETE /api/v1/todo/3 HTTP/1.1
Content-Type: application/json
Authorization: yourAuthorization (token from jwt)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app

App Screenshot

Todolist - Get (another user)

Request

GET /api/v1/todo HTTP/1.1
Content-Type: application/json
Authorization: yourAuthorization (token from jwt when login)
Host: binar-algorithm-fsw-mock-test-production.up.railway.app

App Screenshot

Todolist - Delete (todolist on another user)

App Screenshot

Todolist - Update (todolist on another user)

App Screenshot

Auth - Whoami (after logout with same token)

App Screenshot

SOAL

Apakah Kegunaan JSON pada REST API?

JSON digunakan sebagai format pertukaran data standar di REST API. Ketika klien mengirimkan permintaan HTTP kepada server atau ketika server mengirimkan respons, data seringkali diwakili dalam format JSON. Ini membuat proses pertukaran data antara klien dan server lebih efisien dan konsisten.

Jelaskan bagaimana REST API bekerja

RESTful API bekerja dengan cara memanipulasi resource dan representasi. Representasi ini saling dipertukarkan di antara pengguna dan server melalui antarmuka terstandar dan protokol komunikasi tertentu, biasanya HTTP.

    REST API menggunakan metode HTTP (GET, POST, PUT, DELETE) untuk berinteraksi dengan sumber daya.
    Metode HTTP memberikan operasi umum yang dapat diaplikasikan pada sumber daya:
        GET: Mendapatkan data dari sumber daya.
        POST: Membuat sumber daya baru.
        PUT atau PATCH: Memperbarui sumber daya yang sudah ada.
        DELETE: Menghapus sumber daya.

binar-algorithm-fsw-mock-test's People

Contributors

wahyupambudi avatar

Watchers

 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.