Restful API example using gin web framework gin-gonic/gin.
go get github.com/ns11t/users-movies
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
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.
You can run the tests the usual way
go test ./...
go run server.go
API Documentation is available at /help/api URL