Roman Numbers
This API will receive a string and find the highest roman number and return it's value.
This is a test for Studio Sol
Running on docker
build container
make build
Running container
make container
Requesting roman numbers
You can use GraphQL Playground to request a roman number accessing localhost:8080
Example Request
mutation {
search(text: "AXXBLX") {
number
value
}
}
Requesting with Curl
Request
curl --location --request POST 'localhost:8080/graphql' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"mutation {search(text:\"ABCXZZZZXC\") {number value}}"}'
Response
{"data":{"search":{"number":"CX","value":110}}}
Running on alternative port
Alternatively, you can start container using port 8082
make container_alt
Running locally
go 1.17 is required
go mod download
make run
Testing
make test
What's inside
app/roman
has main algorithm that extracts roman numbers from stringapp/http/handlers
has gin web framework handlers that bootstrap graphql responseapp/http/graph/
contains graphql resolvers and schemas generated by gqlgen
Author Jan Silva