The purpose of this kata is to build a web server with Deno.
The idea here is to get a Deno server running and cover the following:
- Setting up a Deno server
- Creating an API endpoint
- Testing the endpoint
Complete the following:
- Create a Deno server that exposes GET
/hello
endpoint and returns stringHello world!
with status 200. For anything else, returnNot found
with status 404. Hint: It is a good idea to use the Server class for the task although there are other ways to the same. To handle routing, checkrequest.url
. Hint: See the URL class as it can help in parsing the request. To avoid having to restart the server manually while developing, use the --watch mode when running Deno. - To ensure that our server implementation works, test it using Deno test utilities. In other words, set up a test case that uses fetch to hit your endpoint and then ensure what it received matches
Hello world!
. - Optional - Test the failure case (
Not found
, 404) as well. - Add Deno tasks for the added server and test functionalities.