Gopher Translator Service
An interview assignment project. To see the full assignment click here.
Overview
An HTTP API that accepts english word or sentences and translates them to Gopher language.
Endpoints
-
POST /word
Example request:
{ "english_word": "apple" }
Example response:
{ "gopher_word": "gapple" }
-
POST /sentence
Example request:
{ "english_sentence": "Coding in Go is awesome!" }
Example response:
{ "gopher_sentence": "odingCogo gin oGogo gis gawesome!" }
-
GET /history
Example response:
[ { "apple": "gapple" }, { "Coding in Go is awesome!": "odingCogo gin oGogo gis gawesome!" } ]
Running the server
Help
Usage of gopher-translate:
-port int
port number the server should listen on (default 8080)
-specfile string
json file with translation instructions
For example on the specfile check this file.
Run via Go:
$ go run cmd/gopher-translate/main.go --port 8080 --specfile configs/gopher.json
Run in Docker container:
$ docker build -t gopher .
$ docker run --rm -p 8080:8080 gopher
Run via docker-compose:
$ docker-compose up