Categorygithub.com/DazSanchez/go-dynamodb-practice
modulepackage
0.0.0-20220104211048-7ca2551e1919
Repository: https://github.com/dazsanchez/go-dynamodb-practice.git
Documentation: pkg.go.dev

# README

Go DynamoDB Practice

Practice project to connect a REST API on Go made with Gin to AWS DynamoDB database.

Getting started

Install Go

To run this project you need to install Go and set your Go workspace first. Get Go binaries from the downloads page.

Setup AWS Credentials

The project uses environment variables to get AWS keys to connect with AWS DynamoDB, you should follow these guides on how to setup the AWS CLI and configure your account.

Create the Users DynamoDB table

The project assumes you have a Users table on your DynamoDB and it has an ID partition key. You must create it in order for the queries to work.

Clone the repo

Clone the repo in your local machine by executing the following command in a terminal:

$ git clone https://github.com/DazSanchez/go-dynamodb-practice.git

$ cd go-dynamodb-practice

Install dependencies

You must install project's dependencies in order to be able to run it.

$ go get .

Run the server

Once you have installed the dependendies you can run the server with the following command:

$ go run .

This will run the Gin server on port 8000.

Endpoints

Currently there's three endpoints for interacting with DynamoDB:

Get all users

$ curl http://localhost:8000/users -H "Accept: application/json" 

Get user by UUID

$ curl http://localhost:8000/users/<user-id> -H "Accept: application/json" 

Create a user

$ curl -X POST http://localhost:8000/users \
   -H "Content-Type: application/json" \
   -H "Accept: application/json" \
   -d '{ "name":"my_name", "firstSurname":"my_firstSurname", "email": "my_email" }'

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author