Person is a simple CRUD application written in go which exposes API endpoint to create the person.

Person

Person is a simple CRUD application written in go which exposes API endpoint to create the person.

Installation

Install docker in your local system

Run the following command to setup the local postgress db

#docker run -p 5445:5445 -d \
>       -e POSTGRES_PASSWORD=postgres \
>       -e POSTGRES_USER=postgres \
>       -e POSTGRES_DB=targetrwe \
>       -v pgdata:/var/lib/postgresql/data \
>       postgres
>
#docker ps
#docker exec -it 1d096bc3c434 psql -U postgres targetrwe
targetrwe=# CREATE TABLE person (
targetrwe(#  id integer NOT NULL,
targetrwe(#  userid serial NOT NULL,
targetrwe(#  fistname character varying(255),
targetrwe(#  lastname  character varying(255),
targetrwe(#  address  character varying(255)
targetrwe(# );

targetrwe=# INSERT INTO person (id,userid,fistname,lastname,address)
targetrwe-# VALUES(1,100,'firstname','lastname','address');
INSERT 0 1

No need to insert the record but its your choice. Application will automatically insert few records on startup.

Running the application

make run 

The above command will run the application

Endpoints

Use postman or similar tool to call the API

GET Requests

1. Get all persons.

Request URL:

http:\\localhost:8080/
http:\\localhost:8080/persons

2. Get person by id.

Request URL:

http:\\localhost:8080/persons/{id}

3. Get person by userid.

Request URL:

http:\\localhost:8080/persons/user/{id}

POST Requests

1. Create new person.

Request URL:

http:\\localhost:8080/person

Body:

{
        "id": 1,
        "userid": 10000,
        "firstname": "John",
        "lennon": "Lenon",
        "address": "111 ABC Way, Dallas, TX"
    }

PUT Requests

1. Update person details.

Request URL:

http:\\localhost:8080/persons

Body:

{
        "id": 1,
        "userid": 10000,
        "firstname": "George",
        "lennon": "Washington",
        "address": "222 BBC Way, Miami, FL"
    }

DELETE Requests

1. Update person details.

Request URL:

http:\\localhost:8080/persons/{ID}
Similar Resources

simple bank which is implemented using Golang

Banker The service that we’re going to build is a simple bank. It will provide APIs for the frontend to do following things: Create and manage bank ac

Nov 15, 2021

Highly extensible, customizable application launcher and window switcher written in less than 300 lines of Golang and fyne

Highly extensible, customizable application launcher and window switcher written in less than 300 lines of Golang and fyne

golauncher A go application launcher A simple, highly extensible, customizable application launcher and window switcher written in less than 300 lines

Aug 21, 2022

Forklift: an API application developed with go that enables virtual server migration from vcenter virtualization environment to openstack environment

Forklift: an API application developed with go that enables virtual server migration from vcenter virtualization environment to openstack environment

What is the Forklift? Forklift is an API application developed with go that enables virtual server migration from vcenter virtualization environment t

Jan 14, 2022

Simple application to manage basic deployments

Simple application to manage basic deployments Usage You need to create a deployment yaml file (sample). then run the binary file with --config flag t

Aug 29, 2021

Easily create & extract archives, and compress & decompress files of various formats

archiver Introducing Archiver 3.1 - a cross-platform, multi-format archive utility and Go library. A powerful and flexible library meets an elegant CL

Jan 7, 2023

James is your butler and helps you to create, build, debug, test and run your Go projects

James is your butler and helps you to create, build, debug, test and run your Go projects

go-james James is your butler and helps you to create, build, debug, test and run your Go projects. When you often create new apps using Go, it quickl

Oct 8, 2022

create temporary Firefox profile, install user.js and extensions, launch Firefox

tmpfox tmpfox is a Firefox wrapper that: Creates a temporary Firefox profile Installs user.js configuration file from Arkenfox for increased privacy a

Jul 27, 2022

Coding assessment to create Todo app given by Percipia

Coding assessment to create Todo app given by Percipia

Oct 20, 2021

create a provider to get atlassian resources

Terraform Provider Scaffolding This repository is a template for a Terraform provider. It is intended as a starting point for creating Terraform provi

Dec 31, 2021
AutoK3s GEO collects metrics about locates remote IP-address and exposes metrics to InfluxDB.

AutoK3s GEO AutoK3s GEO collects metrics about locates remote IP-address and exposes metrics to InfluxDB. Thanks to https://freegeoip.live/ which prov

Jun 16, 2022
Search running process for a given dll/function. Exposes a bufio.Scanner-like interface for walking a process' PEB

Search running process for a given dll/function. Exposes a bufio.Scanner-like interface for walking a process' PEB

Apr 21, 2022
It is a basic todo app which has CRUD operation using Buffalo and golang

It is a basic todo app which has CRUD operation using Buffalo and golang

Nov 1, 2021
Simple example program using CRUD operations to interface with azcosmos

Simple example program using CRUD operations to interface with azcosmos

Nov 15, 2021
An application that is developed to generate application by API specification

GO boilerplate is an application that is developed to generate application by API specification and Database schema with the collaboration with opn-generator.

Oct 14, 2021
CRUD Product with JWT Auth

simple-crud-product CRUD Product with JWT Auth Start with docker compose up (already featured with database automigrate) Test the API using postman co

Oct 11, 2021
A boilerplate showing how to create a Pulumi component provider written in Go

xyz Pulumi Component Provider (Go) This repo is a boilerplate showing how to create a Pulumi component provider written in Go. You can search-replace

Mar 4, 2022
A limited Flow Access API which runs outside of the Flow Network using the DPS

Access API Flow DPS implements the Flow Access API Specification, except for the following endpoints: SendTransaction GetLatestProtocolStateSnapshot G

Jul 28, 2022
Gitfofo - A cmdline tool utilized github api which can help you to explore your tech boundaries
Gitfofo - A cmdline tool utilized github api which can help you to explore your tech boundaries

why gitfofo gitfofo is a cmdline tool utilized github api which can help you to explore your tech boundaries, find more interest people in github. The

Nov 21, 2022
This is a simple chat app which shows how to use Go with Hotwire.
This is a simple chat app which shows how to use Go with Hotwire.

chat-hotwire-go This is a simple chat app which shows how to use Go with Hotwire. Messages from another user are received via Turbo Streams over a web

Jul 2, 2022