Skip to content

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rest API in Go

This is an API that is capable of managing events, thus being able to create, remove and update events. It is also possible to register users for events and remove a user's registration from an event.

Cloning and accessing the repository

git clone https://github.com/Liedsonfsa/go-rest-api.git
cd go-rest-api

Downloading dependencies

go mod downloading

Environment variables

Create a .env file with the following variables

SECRET_KEY= # secrete key for signing jwt tokens
DB_NAME= # database name
DB_USER= # database user
DB_PASSWORD= # database password

Running the API

go run main.go

Routes that do not require authentication

GET {host}/events       # searching for all events
GET {host}/events/id    # searching for an event by id
POST {host}/signup      # registering a new user
POST {host}/login       # user login

Routes that require authentication

POST {host}/events      # creating a new event
PUT {host}/events/id    # updating a specific event
DELETE {host}/events/id   # deleting a specific event
POST {host}/events/id/register      # registering a user in a specific event
DELETE {host}/events/id/register    # deleting a user's record of a given event

Examples of how routes are used are in the folder /api-test

To perform requests using the files contained in the /api-test folder, the REST Client extension is required.

After installing the extension, open some test file and click Send Request

Technologies

  • Go
  • Gin
  • MySQL
  • JWT

About

Rest API in Go to manage events

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages