Simple server assignment #1

For this assignment, the idea was to create a simple server, similar to the class examples, with 3 different functions or restfull Apis. I looked at different example by Tom Igoe and some by Shawn Van Every. It made me a bit more familiarized with the code language used for this purpose, even if I still don’t understand some parts of the code of the more complex examples. So I chose the example of the “age checker” by Tom Igoe, to built my aplication around it (This, after a great deal of anxiety and confussion about how to get started).

So what I managed to do was simple but allowed me to understant the basics of what we saw on last class, and to realize I should learn about HTML and CSS, and also about web sockets.

The functions for the server I wrote are 3:

  1. Selecting a color in terms of text.
  2. Changing the color of the background.
  3. Loading an image to the background. (still does’t work 🙁 )
  1. The first asks you to put a color input by typing a)http://localhost:8080/check/color/red or b)http://localhost:8080/check/color/green, http://localhost:8080/check/color/blue, c)http://localhost:8080/check/color/(or something else). There is a bug I haven’t figured out when I enter blue. It doesn’t show a text message it’s supposed to show.
  2. The second is for you to change the browser’s background. You enter a)http://localhost:8080/check/imageBackground/:imageBackground/change b)http://localhost:8080/check/imageBackground/:imageBackground/(something-else-other-than-change
  3. The third function is for uploading an image. By entering the word image, an image will be loaded in the browser.

The first two work, but the third, It still doesn’t at this point.

The code at this point, without the image load function working properly for the mean time:

https://github.com/nicosanin/connected_devices/blob/master/colors.js

Leave a Reply

Your email address will not be published. Required fields are marked *