@@ -3,58 +3,87 @@ Erlang Based Cached Fibonacci Server
33
44To Start Server:
55```
6- > {ok,Pid}=febonnacy_server:start_link().
6+ rebar3 run
77```
88
99To Request Febonacci numbber:
1010```
11- > gen_server:call(Pid,{compute,10}).
12- 55
13-
14- > gen_server:call(Pid,{compute,1}).
15- 1
11+ > compute_pool:compute(100).
12+ 354224848179261915075
1613
17- > gen_server:call(Pid,{compute,0}).
18- 0
14+ > compute_pool:compute([4,57,89]). // list sholud be ordered
15+ [3,365435296162,1779979416004714189]
1916
20- > gen_server:call(Pid,{compute,3} ).
21- 2
17+ > compute_pool:compute([57,89,100] ).
18+ [365435296162,1779979416004714189,354224848179261915075]
2219
23- > gen_server:call(Pid,{ compute,10}).
24- 55
20+ > compute_pool: compute([4]).
21+ [3]
2522
26- > gen_server:call(Pid,{ compute, [0,1,3,10]} ). // list Shoud be Ordered List
23+ > compute_pool: compute( [0,1,3,10]).
2724[0,1,2,55]
2825
26+ > compute_pool:compute(100).
27+ 354224848179261915075
2928
3029```
3130To get Input Count :
3231```
33- > gen_server:call(Pid,count).
34- [{1,2},{3,2},{10,3},{0,2}]
32+
33+ > compute_pool:history_count().
34+ [{57,2},{89,2},{1,1},{3,1},{10,1},{4,2},{0,1},{100,3}]
35+
3536```
3637To get Input Result History
3738```
38- > gen_server:call(Pid,history).
39- [{1,1},{3,2},{10,55},{0,0}]
39+ > compute_pool:history().
40+ [{57,365435296162},
41+ {89,1779979416004714189},
42+ {1,1},
43+ {3,2},
44+ {10,55},
45+ {4,3},
46+ {0,0},
47+ {100,354224848179261915075}]
48+
4049```
4150
42- Again Request Febonacci number :
51+
52+ Server API :
53+
54+ History Count API :
4355```
44- > gen_server:call(Pid,{compute,100}).
45- 354224848179261915075
56+ > curl -H 'Content-Type: application/json' http://localhost:5001/fibonacci/history_count
57+ {"57":2,"89":2,"1":1,"3":1,"10":1,"4":2,"0":1,"100":3}
58+ ```
59+ History API :
60+ ```
61+ > curl -H 'Content-Type: application/json' http://localhost:5001/fibonacci/history
62+ {"57":365435296162,"89":1779979416004714189,"1":1,"3":2,"10":55,"4":3,"0":0,"100":354224848179261915075}
4663```
4764
48- Check Count and History:
65+ Fibonacci API with Number as Input:
4966```
50- > gen_server:call(Pid,count).
51- [{1,2},{3,2},{10,3},{0,2},{100,1}]
67+ > curl -X POST -H 'Content-Type: application/json' -i http://localhost:5001/fibonacci/compute --data '{"input": 99}'
68+ 218922995834555169026
69+ ```
70+ Fibonacci API with List as Input
71+ ```
72+ > curl -X POST -H 'Content-Type: application/json' -i http://localhost:5001/fibonacci/compute --data '{"input": [10,34,37,100]}'
5273
53- > gen_server:call(Pid,history).
54- [{1,1},{3,2},{10,55},{0,0},{100,354224848179261915075}]
74+ [55,5702887,24157817,354224848179261915075]
5575```
5676
5777
5878
5979
6080
81+
82+
83+
84+
85+
86+
87+
88+
89+
0 commit comments