suprmat95 / go-mux-postgreSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-mux-postgreSQL

Dependencies

  1. Download and install PostgreSQL following this link
  2. Download and install Go following this link
  3. Install Go modules required
    $ go get -u github.com/gorilla/mux 
    $ go get -u github.com/lib/pq

Setting db

  1. Creation db and products table
    $ psql -U postgres -W
    $ create database go_project
    $ \c go_project
    $ CREATE TABLE products
    (
        id SERIAL,
        name TEXT NOT NULL,
        price NUMERIC(10,2) NOT NULL DEFAULT 0.00,
        CONSTRAINT products_pkey PRIMARY KEY (id)
    );

Server Set Up

    $ export APP_DB_USERNAME=postgres
    $ export APP_DB_PASSWORD=
    $ export APP_DB_NAME=go_project

Running the tests

In the project directory:

    go test -v

Starting the server

In the project directory:

    $ go build
    $ ./go-mux-postgerSQL.git

Test APIs

A full documentation of Api is available at the following link

About

License:MIT License


Languages

Language:Go 100.0%