Sign inSign up

rosemaling/apidemo

By rosemaling

•Updated over 5 years ago

Image
0

120

rosemaling/apidemo repository overview

⁠apidemo

apidemo is a slightly aggrandized Hello World project that taught me the essentials of Spring Boot and Docker. Now, it can live on your machine!

⁠Source Code

Source code for this API is available publicly on my Gitlab.⁠

⁠Getting Started

To start up, enter the following command in your terminal:

docker run -d -p 80:8080 --name myFunApi rosemaling/apidemo:latest

Now, you can visit localhost:80 to access the API.

⁠Endpoints

/hello

  • GET -Status code: 200 OK -Accepts an optional 'name' parameter (a string) -e.g. "/hello?name=Amanda" -Returns "Hello World" (default) or "Hello [MYNAME]", if a name was provided (example case will return "Hello Amanda").

/calculator

  • GET -Status code: 200 OK -Requires a 'values' parameter (an array of integers) and an 'operand' parameter (accepts subtraction, multiplication, division, and addition symbols) -e.g. "/calculator?values=10,2&operand=*" -Returns the calculated value (example case will return 20).

/vowels

  • GET -Status code: 200 OK -Requires a 'word' parameter (a string) -e.g. "/vowels?word=spiral" -Returns the number of vowels (a, e, i, o, u, excluding y) in the given word (example case will return 2).

/searchanddestroy

  • GET -Status code: 200 OK -Requires a 'phrase' parameter (a string), a 'search' parameter (a string), and a 'destroy' parameter (a string) -e.g. "/searchanddestroy?phrase=No%20excuses&search=excuses&destroy=equivocations" -e.g. "/searchanddestroy?phrase=No%20equivocations&search=excuses&destroy=crying" -Returns the 'phrase' string with the first instance of the 'search' string removed and replaced with the 'destroy' string, if the 'search' string is found. If it is not, returns the 'phrase' string (both example cases will return "No equivocations").

Tag summary

Content type

Image

Digest

Size

86.3 MB

Last updated

over 5 years ago

docker pull rosemaling/apidemo