Homework Assignment #1
This is the first of several homework assignments you'll receive in this course. In order to receive your certificate of completion (at the end of this course) you must complete all the assignments and receive a passing grade.
-
Create a public github repo for this assignment.
-
Create a new post in the Facebook Group and note "Homework Assignment #1" at the top.
-
In that thread, discuss what you have built, and include the link to your Github repo.
Please create a simple "Hello World" API. Meaning:
-
It should be a RESTful JSON API that listens on a port of your choice.
-
When someone posts anything to the route /hello, you should return a welcome message, in JSON format. This message can be anything you want.
I tried to follow the recipe from the lectures, and I came up with this solution.
Particularly, I created an uniform return object. The answers also trasmit if an error had been identified:
- if the path is present in routes (actually, there is only one, '``hello`'):
{
"isError": false,
"message": "Text sent." // echoing back the message
}
- if the path sent is not present into routes
{
"isError": true,
"message": "Wrong path: []. Use one of [hello]"
}