Starter REST API + MongoDB Connection example written in GoLang
cp .env.example .env
DB_NAME=your_database_name
DB_URL=mongodb://<user_name>:<password>@<host>:<port>/<dbname>
go run main.go
The starter has 2 endpoints:
POST /api/person
Payload:
{
"firstname": "hello",
"lastname": "world",
"age": 25
}
GET /api/person/{personID}