- Golang SDK. See the Golang SDK installation instructions.
- An IDE that supports Golang. You can install Android Studio, IntelliJ IDEA, or Visual Studio Code and install the Golang plugins to enable language support and tools for refactoring, running and debugging your backend.
- To start a local project using Golang
go mod init <project name>
- To add packages to our project
go get <package name>
Run the following commands to run the project
go build main.go
go run main.go
I have not used a .env file for the MongoDB Url now for ease of evaluation. I can do the same while working on real life projects.
- /users - to get all users (GET)
- /users - to create a user (POST)
- /users/{id} - to get an existing user (GET)
- /posts - to get all posts (GET)
- /posts - to create a post (POST)
- /posts/{id} - to get a exisitng post (GET)
Get an existing user | Create a new user |
---|---|
![]() |
![]() |