Skip to content

Restful Api Service for calculating tribonacci numbers.

Notifications You must be signed in to change notification settings

dmirou/tribonaccirest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dmirou/tribonaccirest

Application dmirou/tribonaccirest implements Restful Api for calculating tribonacci numbers using an matrix exponentiation.

Run with docker

  1. To build new image use
docker build --rm -f <path/to>/tribonaccirest/Dockerfile -t tribonaccirest:latest <path/to>/tribonaccirest
  1. To run created image
docker run --rm -d -p 8080:8080 --name tribonaccirest tribonaccirest:latest
  1. Now you can send request to <protocol>://<your-domain>:8080/tribonacci/{n}, where {n} is positive integer and receive the response.

For example, if your domain is "localhost", you run command

curl http://localhost:8080/tribonacci/5

the response will be

{"code":200,"desc":"OK","data":{"n":5,"tribonacci":2}}

Application restrictions

  • The source number "n" must be a positive integer.
  • Max calculation time of one tribonacci number is 4 seconds (4000 ms). If the calculation is more than 4 seconds you receive the result with code 460 and empty data. You can change max calculation time by changing the constant maxTribonacciCalcTimeInMs in app.go

About

Restful Api Service for calculating tribonacci numbers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages