Skip to content

YashMeh/golang-restAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful API using golang


Go Report Card


This is a very simple REST api, made entirely for the sake of learning coding patterns in golang.Any suggestions are welcome 😃

Endpoints

Method Endpoint Description
GET /api/books returns the list of all books
GET /api/book/id returns the book with the given id
POST /api/books creates a book
PUT /api/book/id updates the book with the given id
DELETE /api/book/id deletes the book with the given id

Setup

  • Create postgres table using table.sql

  • Setup environment variables in the root directory using

export DBHOST=127.0.0.1
export DBPORT=5432
export DBUSER=parzival
export DBPASS=yash123
export DBNAME=foo

Running 🏃

go build -o restapi && ./restapi

Testing 🚨

  • Start the API using
go build -o restapi && ./restapi
  • Run the tests
go test

Todo

  • Include route tests
  • Include integration tests
  • Dockerize
  • Generate go-report
  • Create CI

References

About

Just for the sake of learning clean architecture with golang.

Topics

Resources

Stars

Watchers

Forks