Categorygithub.com/GiorgiMakharadze/video-service-API-golang
modulepackage
0.0.0-20230919215850-df7a07f86026
Repository: https://github.com/giorgimakharadze/video-service-api-golang.git
Documentation: pkg.go.dev

# README

Video Service API - Golang

License: MIT

A RESTful API built with Go using the Gin framework, to handle video-related services including creating and listing video resources.

Prerequisites

Getting Started

Clone the repository to your local machine using the following command:

$ https://github.com/GiorgiMakharadze/video-service-API-golang.git

$ go run server.go

API Endpoints

The CLI tool takes three arguments:

  1. GET /api/videos: Retrieves a list of all video resources.
  2. POST /api/videos: Creates a new video resource with the data provided in the request body.
  3. GET /view/videos: Renders an HTML page displaying all the videos.

Usage

Creating videos

To create a video, make a POST request to the /api/videos endpoint with a JSON payload that matches the structure below:

{
    "title": "Cool gin framework",
    "description": "test",
    "url": "https://www.youtube.com/example/test",
    "author": {
        "firstName": "John",
        "lastName": "Doe",
        "age": 20,
        "email": "[email protected]"
    }
}

Notes

The application uses Go Playground Validator for validating the input data. The custom validation function ValidateCoolTitle checks if the word "Cool" is present in the video title.

Logging

Logs are written to a file named gin.log in the root directory, and also printed to the console.

Authentication

The /api endpoints are protected with basic authentication. Use the following credentials:

  • Username: test
  • Password: user

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author