arief-hidayat / go-video-api

simple API for fun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is this?

Simple app to search video (postgreSQL full text search)

Prepare Your DB

see DB setup docs

Run App

Example to connect the default docker setup

DB_NO_SSL=true DB_PWD=password123 go run ./server/cmd/main.go

or if you want to run on docker

docker build -t api .
docker run -e DB_NO_SSL=true -e DB_PWD=password123 \
-eDB_HOST=host.docker.internal -p 8000:8000 api 

Test API

curl "http://127.0.0.1:8000/videos?q=sea"

or can use tools like vegeta

  echo "GET http://127.0.0.1:8000/videos?q=sea" | vegeta attack -rate 100/1s -timeout 2s -duration=30s | tee results.bin | vegeta report
  vegeta report -type=json results.bin > metrics.json
  cat results.bin | vegeta plot > plot.html
  cat results.bin | vegeta report -type="hist[0,100ms,200ms,300ms]"

About

simple API for fun


Languages

Language:Go 93.3%Language:Dockerfile 6.7%