Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Starter REST API + MongoDB Connection example written in GoLang

Notifications You must be signed in to change notification settings

cristianoventura/golang-rest-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang-rest-mongodb

Starter REST API + MongoDB Connection example written in GoLang

Copy the .env file

cp .env.example .env

Add your MongoDB connection to the .env file

DB_NAME=your_database_name
DB_URL=mongodb://<user_name>:<password>@<host>:<port>/<dbname>

Run the application

go run main.go

Endpoints

The starter has 2 endpoints:

Insert a document in the database

POST /api/person

Payload:

{
    "firstname": "hello",
    "lastname": "world",
    "age": 25
}

Retrieve the document from the database

GET /api/person/{personID}

About

Starter REST API + MongoDB Connection example written in GoLang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages