Skip to content

manolovh/GoWebApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This application provides information about given math expressions. It has 3 communication endpoints:
 - `/validate` - returns JSON format whether an expression is valid or not
 - `/evaluate` - returns JSON format with the result of an expression, if valid, or error, if not
 - `/errors` - returns JSON format with all invalid expression at different endpoints and their frequency, or null if none

1. Start the application with `go run webApi.go`
2. Options to communicate with the API:
  2.1. In the same process, enter:
       - `<endpointName> <jsonfileName>` for endpoints "/validate" and "/evaluate"
       - `<endpointName>` for endpoint "/errors"
  2.2. In a different process, execute:
       - `curl localhost:8080<endpointName> --header "Content-Type: application/json" -d @<jsonfileName>` for endpoints "/validate" and "/evaluate"
       - `curl localhost:8080<endpointName>` for endpoint "/errors"

The input JSON file shall follow the following format `{ "expression": "example math expression" }`.

Run the webApi_test.go unit tests by executing `go test -v webApi_test.go webApi.go`.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages