Skip to content

Latest commit

 

History

History

express-introduction

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Introduction to Express

Goal

  • Write your first API
  • Write you first HTML generated page
  • Deploy your app to a server

Setup

Install express

Follow the steps described on Express installation guide

Mini katas

1. Express hello world

  • Create a webserver that returns "Hello world!" when accessing via GET to the /hello

Tip:

2. Hello world using Postman

  • Make a request to our just created server using Postman

Download the program using the Postman webpage

Tip: How to make a request using Postman

3. Hello your name

  • Create a webserver that returns, for example, "Hello Luis!" when accessing via GET to the /hello/Luis

Tip: Read about Route parameters.

4. Hello stored name

  • Create a webserver that returns, for example, "Hello Luis!" when accessing via GET to the /hello
  • The name of the person should be read from a file.
  • Use asynchronous methods.

Tips:

5. First post request

  • Create an end-point that allows to update the name that we will return on the previous mini kata.
  • The HTTP Response code should be 201.

Tip:

  • You may need to use Postman to access this end-point.
  • Think the type of HTTP request needed.
  • Think the name of the parameter you want to use

6. First template

  • Update the Hello your name to display a webpage with proper HTML Tags
  • Use handlebars as a template library

Tip: Integrate handlebars with express using express-handlebars

7. First middleware

  • Adds a middleware to log into a file all the request made to our webserver.
  • The filename should be called requests.log
  • Each line of the log should contain:
    • The date when the request was made
    • The url that access

Tip: Follow the Middleware express guide

8. Deploy your app

  • Make your app available on internet.

Tip: Follow the Getting started guide on Heroku

Author

Luis Rovirosa