Design
For this exercise, you will use node to create a server that manages images in a directory. The server can perform 3 tasks:
1) List the images available for download. An HTTP GET request with path of '/Action/list' will trigger this response.
2) Download an image. An HTTP GET request with path of '/Files/image.jpg' will send the file 'image.jpg' to the client.
3) Upload an image. An HTTP POST request with path of '/Files/image.jpg' will contain binary data in its body that will be saved as 'image.jpg' on the server.
The following capture demonstrates how the server should work and the common errors it should handle:
Design is the important aspect of this assignment. Use the principles you've learned in class to make a clean, maintainable design. For example, a request for the server to manage memos (say, for an emergency department) in another directory should be an easy change.
Marking will be done in two parts: you will demonstrate your server working in Wednesday's lab (2 marks) and hand in a hard-copy of your code for its design to be evaluated (2 marks) for a maximum of 4 marks.
Check out the comments for some hints. Also, please post your questions here.