go-rest

command module
v0.0.0-...-50c1859 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2019 License: MIT Imports: 10 Imported by: 0

README

go-rest

Build Status Go Report Card codecov

This is a simple application that interfaces with a PostgreSQL database and exposes a REST API with GET, POST, PUT and DELETE methods to access and manipulate it.

Configuration

The database details are fetched from the following ennvironment variables: db_host - The database server host, e.g localhost db_user - The database server user, e.g root db_port - The port used to access the database server, e.g 5432 db_port - The database password, e.g 1q2w44f5g db_name - The database name, e.g my_database db_type - This should be set to 'postgres'

Running

Simply run 'rest.exe'. The program will be launched on localhost:8000/users. Ensure you have set up the environment variables in your local environment.

Building from source

Prerequisites

You must have a recent version of the Go compiler installed. GOROOT, GOPATH and GOBIN environment variables should be set up for convenience. Visit https://www.golang.org to learn how to set up Go.

The following third-party libraries are required to build the program from the source.

  1. gorilla/mux
  2. jinzhu/gorm
  3. lib/pq
  4. joho/godotenv
Process

Navigate to the program folder and run the go build command. You may also use go install path/to/package to create a binary, or go run path/to/package to compile and run.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL