An interview assignment project. To see the full assignment click here.
An HTTP API that accepts english word or sentences and translates them to Gopher language.
-
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!" } ]
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.
$ go run cmd/gopher-translate/main.go --port 8080 --specfile configs/gopher.json
$ docker build -t gopher .
$ docker run --rm -p 8080:8080 gopher
$ docker-compose up