Skip to content

andvikram/perScoreCal

Repository files navigation

perScoreCal

Getting Started

Dependencies

  1. Go Lang - installed and Go path set

  2. PostgreSQL - installed and running

  3. Clone this project to $GOPATH/src

  4. A .env file in the root of the project with the following keys

export DEV_DB_DRIVER=
export DEV_HOST=
export DEV_DBNAME=
export DEV_SSLMODE=
export DEV_USERNAME=
export DEV_PASSWORD=

export TEST_DB_DRIVER=
export TEST_HOST=
export TEST_DBNAME=
export TEST_SSLMODE=
export TEST_USERNAME=
export TEST_PASSWORD=

  1. From the root of the project execute source .env

  2. Install the godep package with go get github.com/tools/godep

  3. Install package dependencies with godep restore

Build and run this project

  1. Give privilege to the setupPostgres.sh file

    chmod +x setupPostgres.sh

  2. Execute setupPostgres.sh to create Postgres role and database

    ./setupPostgres.sh

  3. Run command to migrate database

    go run main.go setupdb

  4. Start the server

    go run main.go serve

Code structure and details

Directory structure

perScoreCal
- .git
- cmd
- Godeps
- models
- perScoreProto
- server
- vendor
-- main.go
-- setupPostgres.sh

Description

The cmd directory holds the code for the CLI commands created by Cobra. The project itself was created using the Cobra Generator.

The Godeps directory contains the Godeps.json file which is where all the package dependencies for the project is saved.

The models directory holds all the business logic and data operations using the Gorm package.

The perScoreProto directory holds the Proto definition files as well the compiled Go files generated by the protoc command.

The server directory has two files - one for bringing up the GRPC server and another to route the requests to methods/functions.

The main.go file is what we use to fire the commands, including bringing up the server. It is the entry point to the application.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published