ns11t / users-movies

restful api example using gin web framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

users-movies

Restful API example using gin web framework gin-gonic/gin.

Installaion

go get github.com/ns11t/users-movies

Configuration

All server parameters are stored in config/config.json

{
  "Host": "127.0.0.1",
  "Port": "5432",
  "Dbname": "users_movies_db",
  "Sslmode": "disable",
  "User": "ivan_ivanov",
  "Password": "",
  "SessionKeysPath": "contrib/sessionKeys"
}

Host, Port, Dbname, Sslmode, User and Password are used for database connection. Empty database should be created before the server launching. SessionKeysPath is a path to a directory where RSA keys are stored. They could be generated using following commands:

openssl genrsa -out app.rsa keysize
openssl rsa -in app.rsa -pubout > app.rsa.pub

Migration

You can use data migration script in order to generate some test data before launching the server

go run example/migration.go

It will insert some test movies and genres into database.

Tests

You can run the tests the usual way

go test ./...

Starting The Server

go run server.go

API Documentation

API Documentation is available at /help/api URL

About

restful api example using gin web framework


Languages

Language:Go 100.0%