Book-API was made using Golang and PostgreSQL with technique CRUD with mux and pq

Book-API CRUD with PostgreSQL

Table of contents 👀

General info

BAPI or Book-API is a Golang REST API made to show some detail book for person.

The BAPI Object 🍵

Properties Description Type
judul_buku the identity title book String
penulis author book String
tgl_publikasi date of publication String

Routes

Routes HTTP Methods Description
/api/book/ GET Displays all book
/api/book/ POST Creates a new book
/api/book/{id} GET Displays a specific book, given its name
/api/book/{id} PUT Update identitiy book
/api/user/{id}} DELETE Deletes a specific book, given its id

Technologies

Project is created with:

  • Golang
  • gorilla/mux
  • lib/pq
  • joho/godotenv
  • PostgreSQL

How I built it

👉 Check out the series here!

Setup

To run this project locally, clone repo and add an .env file in the root:

POSTGRES_URL="Postgres connection string"

Then execute in command prompt:

$ cd go-postgres
$ go mod tidy
$ go run main.go

API Reference

These are the endpoints available from the app

GET /api/book/

Returns result identity

Response

Show example response

{
  "data": [
    {
     "judul_buku":"Al Wajiz",
     "penulis": "Imam Ibnu Taimiyah",
     "tgl_publikasi":"2020-10-11",
    }
  ]
}


POST /api/book/

Creates a new identity book

Request

This request requires body payload, you can find the example below.

Show example payload

{
    "judul_buku":"Al Wajiz",
     "penulis": "Imam Ibnu Taimiyah",
     "tgl_publikasi":"2020-10-11",
}

GET /api/book/:id

Returns a book by id

Response

Show example response

{
  "meta": {
    "code": 200
  },
  "data": {
    "id": 1,
    "judul_buku":"Al Wajiz",
     "penulis": "Imam Ibnu Taimiyah",
     "tgl_publikasi":"2020-10-11",
  }
}


UPDATE /api/book/:ID

Update value of identity book

Response

Show example response

{
    "judul_buku":"Al Wajiz",
    "penulis": "Imam Ibnu Taimiyah",
    "tgl_publikasi":"2020-10-11", 
}


DELETE /api/book/:ID

Delete team by id

Owner
Hafizh
I Love be an Open Source Enthusiast and contributing in open source, I hope my knowledge is useful for others
Hafizh
Similar Resources

A discord chat exporter, made in golang

Discord Chat exporter ⚠️ THIS PROJECT IS STILL UNDER DEVELOPMENT, NOT EVEN OUT AS A BETA ⚠️ This is a golang implemintation of a discord chat explorer

Nov 28, 2022

Sensu-go-postgres-metrics - The sensu-go-postgres-metrics is a sensu check that collects PostgreSQL metrics

sensu-go-postgres-metrics Table of Contents Overview Known issues Usage examples

Jan 12, 2022

A simple tool to sync your etcd cluster to PostgreSQL in realtime.

etcd-postgresql-syncer A simple tool to sync your etcd cluster to PostgreSQL in realtime. It sets up a watcher on etcd and commits all changes to Post

Jan 20, 2022

Pagodasite - Pagoda site written in go uses echo postgresql redis-cli

Pagodasite - Pagoda site written in go uses echo postgresql redis-cli

Pagoda: Rapid, easy full-stack web development starter kit in Go Table of Conten

Feb 20, 2022

Simple backup tool for PostgreSQL

pg_back dumps databases from PostgreSQL Description pg_back is a dump tool for PostgreSQL. The goal is to dump all or some databases with globals at o

Dec 25, 2022

🚢 Go package providing lifecycle management for PostgreSQL Docker instances.

🚢  Go package providing lifecycle management for PostgreSQL Docker instances.

🚢 psqldocker powered by ory/dockertest. Go package providing lifecycle management for PostgreSQL Docker instances. Leverage Docker to run unit and in

Sep 2, 2022

Container Registry Synchronization made easy and fast

🚀 booster - Makes synchronization of container images between registries faster.

May 12, 2022

Cheiron is a Kubernetes Operator made with OperatorSDK for reconciling service account and attaching imagePullSecrets to service accounts automatically

anny-co/cheiron NOTE: Cheiron is currently in very early stages of development and and far from anything usable. Feel free to contribute if you want t

Sep 13, 2021

simple cloud made in GO

 simple cloud made in GO

simple cloud made in GO im doing this for fun and practice its a really simple cloud and its finished but the frontend its a little bit shitty.If you

Jun 19, 2022
Go-Mongodb API - A sample REST API ( CRUD operations ) created using Golang

Go-Mongodb_API This is a sample REST API ( CRUD operations ) created using the G

May 31, 2022
terraform-plugin-mux Example (framework + framework)

Terraform Provider Scaffolding (Terraform Plugin Framework) This template repository is built on the Terraform Plugin Framework. The template reposito

Feb 8, 2022
terraform-plugin-mux Example (upgrade(sdk/v2) + framework)

Terraform Provider Scaffolding (Terraform Plugin Framework) This template repository is built on the Terraform Plugin Framework. The template reposito

Feb 8, 2022
crud is a cobra based CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service documentation and k8s deployment manifests

crud crud is a CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service docum

Nov 29, 2021
A simple program to automatically backup a database using git. Err handling by Sentry, Reporting by Betteruptime. Made with 🩸 , 😓 & 😭

backup What is this? A Simple program to automatically backup a database using git. Err handling by Sentry, Uses heartbeats by Betteruptime Made with

Nov 4, 2022
Using the Golang search the Marvel Characters. This project is a web based golang application that shows the information of superheroes using Marvel api.
Using the Golang search the Marvel Characters. This project is a web based golang application that shows the information of superheroes using Marvel api.

marvel-universe-web using the Golang search the Marvel Universe Characters About The Project This project is a web based golang application that shows

Oct 10, 2021
Repo CRUD - write e read in mongoDB
Repo CRUD - write e read in mongoDB

Meli User - userwrite Este repo é responsável por um cadastro onde teremos somen

Jan 3, 2022
[WIP] Basic Echo CRUD template (no pagination)

echo-crud-template [WIP] Basic Echo CRUD template (no pagination) Overview Based on https://github.com/xesina/golang-echo-realworld-example-app. Echo

Jan 11, 2022
Kubegres is a Kubernetes operator allowing to create a cluster of PostgreSql instances and manage databases replication, failover and backup.

Kubegres is a Kubernetes operator allowing to deploy a cluster of PostgreSql pods with data replication enabled out-of-the box. It brings simplicity w

Dec 30, 2022
PolarDB Stack is a DBaaS implementation for PolarDB-for-Postgres, as an operator creates and manages PolarDB/PostgreSQL clusters running in Kubernetes. It provides re-construct, failover swtich-over, scale up/out, high-available capabilities for each clusters.
PolarDB Stack is a DBaaS implementation for PolarDB-for-Postgres, as an operator creates and manages PolarDB/PostgreSQL clusters running in Kubernetes. It provides re-construct, failover swtich-over, scale up/out, high-available capabilities for each clusters.

PolarDB Stack开源版生命周期 1 系统概述 PolarDB是阿里云自研的云原生关系型数据库,采用了基于Shared-Storage的存储计算分离架构。数据库由传统的Share-Nothing,转变成了Shared-Storage架构。由原来的N份计算+N份存储,转变成了N份计算+1份存储

Nov 8, 2022