Building our first service – finding the Roman numeral

With the concepts we have built upto now, let us write our first basic REST service. This service takes the number range (1-10) from the client and returns its Roman string. Very primitive, but better than Hello World.

Design:

Our REST API should take an integer number from the client and serve back the Roman equivalent.

The block of the API design document may look like this:

HTTP Verb PATH Action Resource
GET /roman_number/2 show roman_number

Implementation:

Now we are going to implement the preceding simple API step-by-step.

Code for this project is available at https://github.com/narenaryan/gorestful

As we previously discussed, you should set the GOPATH first. Let us assume ...

Get Building RESTful Web services with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.