Coder Social home page Coder Social logo

belajar-rbac-session's Introduction

Review Assignment Due Date

Week 15 Dandi Rizky (Backend Extra)


For this week assignment, i'm trying to containerizing the apps from week 14 using docker and creating beautiful documentation using swagger.

Docker Hub 🐳


My Docker Hub Images : https://hub.docker.com/r/dandirizkyy/w15-dandi-myapp

Installation πŸ”¨


In order to run this project locally, you need to clone this repository first using git clone

$ https://github.com/revou-fsse-1/w15-my-backend-extra-DandiRizkyy.git

then run pnpm install in your terminal to download all dependencies

$ pnpm install

create docker-compose.yaml on root folder (where the package.json installed) and fill with these commands to install postgresql database locally on your computer

version: '3.9'
services:
  database:
    image: postgres:alpine
    container_name: dandirizky-mydatabase
    hostname: database
    volumes:
    - postgres:/var/lib/postgresql/data
    ports:
    - 5432:5432
    env_file:
    - .env
    restart: always
  app:
    image: dandirizkyy/dandirizky-w15-myapp
    container_name: dandirizky-myapp
    build: .
    ports:
    - 4001:4001
    env_file:
    - .env
    depends_on:
    - database
    restart: always
volumes:
  postgres:

don't forget to create .env files on root folder same like before with these command:

DATABASE_URL="postgresql://revou:password@database:5432/revou?schema=public"

and run docker with these command:

docker-compose up -d

after that you can start the server using these following command :

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

if you want to stop docker, you can use these command

docker-compose stop

Documentation πŸ“·


Swagger Documentation

Here you can find my documentation using swagger : https://w15-webapp-dandi.onrender.com/docs


Endpoint Documentation

  1. First of all, all you need to do is registering your email and password first.
  • register

    || Register Endpoint ||
    
    POST     /auth/register
    
    {
    "email": "[email protected]",
    "password": "example123"
    }
    
  1. After that, you can login with email and password that you registered before
  • login

    || Login Endpoint ||
    
    POST     /auth/login
    
    {
    "email": "[email protected]",
    "password": "example123"
    }
    
  1. After you successfully login, you can access the resources endpoint such as users and products.
  • users

    || Users Endpoint ||
    
    GET     /users
    
  • products

    || Products Endpoint ||
    
    GET     /products
    --------------------
    GET     /products/1
    --------------------
    POST    /products
    
    {
    "title": "Example Title",
    "description": "Example Description",
    "category": "Example Category",
    "userId": 1
    }
    --------------------
    PUT     /products/1
    
    {
    "title": "Example Title",
    "description": "Example Description",
    "category": "Example Category",
    "userId": 1
    }
    --------------------
    PATCH   /products/1
    
    *Optional field, you can change either one value or multiple value at once
    
    {
    "title": "Example Title",
    "description": "Example Description",
    "category": "Example Category",
    "userId": 1
    }
    --------------------
    DELETE  /products/1
    
    
  1. Anddd for the last step.. dont forget to logout :)
  • logout

    || Logout Endpoint ||
    
    POST     /auth/logout
    

Technologies πŸ’»


  • NestJS
  • Swagger
  • Typescript
  • PrismaORM
  • PostgreSQL
  • Docker

Support πŸ™Œ


Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

belajar-rbac-session's People

Contributors

dandirizkyy 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.