Skip to content

Coder-Academy-Patterns/node-vanilla-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Challenges

  1. Add /postcode/3021 json response
  2. Add sendHTML(response, mainHTML) function to utils.js sendHTML(response, `

    About

    This is a paragraph

    `)
  3. Change the not found route to send back JSON instead of plain text, while still keeping the 404 status code — e.g. { "error": "Page not found" }
  4. Add /assets/main.css route with some simple CSS
  5. Change sendHTML() to add a <link> to the main.css URL
  6. (Advanced) Add an assets directory with an gif file inside. Serve that file at /assets/example.gif with the correct content type.
  7. (Advanced) Add a catch-all /postcode/(number) route, which reads a matching file in a postcodes directory. e.g. /postcode/3040 will read the file at /postcodes/3040.json in the project directory, and send it back. Otherwise, if no matching file is found, it will 404

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published