GithubHelp home page GithubHelp logo

midterm-gigih-3.0's Introduction

Midterm GIGIH 3.0

How to run

Before you run the project, make sure to complete .env file such as PORT, HOST and MONGODB_URI.
You can populate the database using this command

npm run seed:all

You can use this command to run:

npm run start:dev

or for production

npm run start

Database Structure

Collections:

  1. Videos: store videos data
// videos model
{

  _id: String,
  title: String,
  description: String,
  thumbnails: {
    default: {
      url: String,
      width: Number,
      height: Number,
    },
    medium: {
      url: String,
      width: Number,
      height: Number,
    },
    high: {
      url: String,
      width: Number,
      height: Number,
    },
    standard: {
      url: String,
      width: Number,
      height: Number,
    },
    maxres: {
      url: String,
      width: Number,
      height: Number,
    }
  }
}
  1. Comments: store comments of every user on specific videos
// comments model
{
  name: String,
  body: String,
  videoId: String,
  imageUrl: String,
}
  1. Products -> store products
// products model
{
  title: String,
  description: String,
  price: Number,
  discountPercentage: Number,
  rating: Number,
  stock: Number,
  brand: String,
  category: String,
  thumbnail: String,
  images: [String],
}

see more on: infrastructures\database\mongoDB\models

API Structure

The api structure based on api minimum requirment. I also tried to implement clean architectur on this project.

#Vidoes

  • Video object
{
  id: string
  title: string
  thumbnails: string
  description: string
}

GET /v1/videos

Return list of videos.

  • URL Params
    None
  • Data Params
    None
  • Headers
    Content-Type: application/json
  • Success Response:
  • Code: 200
    Content:
{
  status: 'success',
  videos: [
    {<video_object>},
    {<video_object>},
    {<video_object>}
  ]
}

GET /v1/videos/:id

Return video detail.

  • URL Params
    Required: id=[string]
  • Data Params
    None
  • Headers
    Content-Type: application/json
  • Success Response:
  • Code: 200
    Content:
{
  status: 'success',
  video: {<video_object>}
}

#Products

  • Product object
{
  id: mongoDB id object
  title: string
  thumbnails: string
  description: string
  price: number
}

GET /v1/products

Return list of products.

  • URL Params
    None
  • Data Params
    None
  • Headers
    Content-Type: application/json
  • Success Response:
  • Code: 200
    Content:
{
  status: 'success',
  products: [
    {<product_object>},
    {<product_object>},
    {<product_object>}
  ]
}

#Comments

  • Comment object
{
  id: mongoDB id object
  name: string
  body: string
  videoId: string
  imageUrl: string
  createdAt: datetime(iso 8601)
}

GET /v1/comments/:id

Return list of comments of a specific vidoe.

  • URL Params
    Required: id=[string] (video id)
  • Data Params
    None
  • Headers
    Content-Type: application/json
  • Success Response:
  • Code: 200
    Content:
{
  status: 'success',
  comments: [
    {<comment_object>},
    {<comment_object>},
    {<comment_object>}
  ]
}

POST /v1/comments/:id

Create a comment of a specific vidoe.

  • URL Params
    Required: id=[string] (video id)
  • Data Params
    None
  • Headers
    Content-Type: application/json
  • Success Response:
  • Code: 200
    Content:
{
  status: 'success',
}

Next update (I hope)

  • Make this readme very clear and easy to understand
  • Learn more about clean architecture and test driven development for API
  • Add authentication and authorization feature.

midterm-gigih-3.0's People

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.