Shannspan / clg-nodejs-4

CLG Node JS Lesson 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clg-nodejs-4

CLG Node JS Lesson 4

  • Initialise a new NPM folder called 'myAPI'

  • Create a local server using express that listens to port '3000'

  • Build a response that retruns 'hello world' on the route path http://localhost:3000/

  • Now modify the middleware to add a new route 'firstServer' and display a message, "Hi there! This is my first route built using express framework."

  • Now modify the middleware to add a route that will accept 'firstUser/:id' and display the message, "Hi there you user id is..."

  • Now modify your code to handle a route that does not exist. Return a 404 page for a route that's not handled eg. '/noroute'

  • Run the code through your terminal

  • The result should be displayed in http://0.0.0.0:3000/firstServer

    • This step later removed from assignment by tutor
  • Exit Node.js

About

CLG Node JS Lesson 4


Languages

Language:JavaScript 100.0%