Skip to content

NGunthor/papercup-task

Repository files navigation

Papercup-task

This is a simple application on grpc with provided swagger

Deployment

Deployment makes docker container with the App(see: ./Dockerfile) and compose it with postgres container(see: ./docker-compose.yml)

Before deployment(see: ./Makefile all): runs tests, makes migrations, generates API, runs the App

Project structure

├───api
│   └───v1
├───cmd
│   └───video_service
├───config
├───internal
│   ├───auth
│   ├───pkg
│   │   ├───components
│   │   │   ├───annotation
│   │   │   └───video
│   │   ├───domain
│   │   ├───storage
│   │   └───youtube
│   └───services
│       └───video_service
└───migration


Run Application

git clone https://github.com/NGunthor/papercup-task
cd papercup-task
docker-compose up -d
Rebuild containers

docker-compose build --no-cache

Add new endpoint

  1. modify api/v1/ or create new .proto
service VideoService {
  // ...
  rpc GetVideo(GetVideoRequest) returns (GetVideoResponse) {};
}
  1. make generate
  2. add API handler ./internal/services
func (s *videoService) GetVideo(ctx context.Context, in *pb.GetVideoRequest) (*pb.GetVideoResponse, error) {
	// ...
}
  1. add source files ./internal/pkg

API

address: localhost:8080/sw

API Accordingly to the Task

  • CreateVideo
  • DeleteVideo
  • CreateAnnotation
  • GetAnnotations
  • UpdateAnnotation
  • DeleteAnnotation

Auth

Service uses internal token auth. I couldn't add passing token fields in swagger so I would recommend to use browser plugins to add proper headers to your HTTP request

TOKENS -> ./config/auth_tokens.go

Headers:

  • "x-service-name"
  • "x-internal-token"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages