OpenMRS

GoLang-1: Create a Hello World Server

This will be a set of tasks to introduce you to Go for backend development.

  1. Download Go 1.13.5 SDK.
  2. Make sure the SDK directory is in your PATH. (you can check by running go version in your terminal).
  3. Create a directory and run go mod init <GITHUB_URL>. GITHUB_URL is the location where your GitHub repository will be (e.g. github.com/f4ww4z/gci-openmrs-go-1. This will initialize your project.
  4. Initialize the project as a git repository.
  5. Run go get github.com/gin-gonic/gin to install Gin dependency.
  6. Commit and push the existing code to a GitHub repository. Then, create a new branch.
  7. Create /hello endpoint, where it should return the message Hello world! in JSON format e.g. { "message": "Hello world!" }
  8. Create /greet/:name endpoint, where :name is a parameter. It should output Hello <name parameter>! in JSON format.
  9. Commit and push this new branch. Create a PR to master.

Your commit message should be GCI-<your_gci_id> message.

Submission steps

  1. Your PR link
  2. Two screenshots showing the responses in the Postman for /hello endpoint and /greet/:name endpoint.
  3. Write on the advantages of using Go instead of other backend frameworks.

Task tags

  • go
  • backend

Students who completed this task

ajey muthiah, Ali Ayad, prathamesh_m009, xuxe, riskycase, Nayan, PermissionError, Ribhav Sharma, lukasz-zbrzeski, dzejqub, CSY2002, Devanshk09, tixpro, Snigdho

Task type

  • code Code
close

2019