This is a simple application on grpc with provided swagger
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
├───api
│ └───v1
├───cmd
│ └───video_service
├───config
├───internal
│ ├───auth
│ ├───pkg
│ │ ├───components
│ │ │ ├───annotation
│ │ │ └───video
│ │ ├───domain
│ │ ├───storage
│ │ └───youtube
│ └───services
│ └───video_service
└───migration
git clone https://github.com/NGunthor/papercup-task
cd papercup-task
docker-compose up -d
docker-compose build --no-cache
- modify api/v1/ or create new .proto
service VideoService {
// ...
rpc GetVideo(GetVideoRequest) returns (GetVideoResponse) {};
}
make generate
- add API handler ./internal/services
func (s *videoService) GetVideo(ctx context.Context, in *pb.GetVideoRequest) (*pb.GetVideoResponse, error) {
// ...
}
- add source files ./internal/pkg
address: localhost:8080/sw
API Accordingly to the Task
- CreateVideo
- DeleteVideo
- CreateAnnotation
- GetAnnotations
- UpdateAnnotation
- DeleteAnnotation
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"