project: Express, forms and templates

Story points 3
Tags node express
Hard Prerequisites
IMPORTANT: Please review these prerequisites, they include important information that will help you with this content.
  • PROJECTS: Node & SQL assignment
  • TOPICS: ExpressJs

  • In this project you’ll be using Express to create a form that lets users interact with your database

    Create a basic HTML form

    Create an HTML form. This form will be used to create Visitor fields in your database. Your form should have the following fields:

    • visitor name
    • your name (name of the person who assisted the visitor)
    • visitor’s age
    • date of visit
    • time of visit
    • comments

    use express to host the form as a static resource

    Create a basic express.js application and serve your form as a static file

    The URL should be http://localhost:[YOUR_PORT]/new_visitor

    submit the form

    There should be a submit button on the form. When the user submits the form then the following should happen:

    1. The form data will be collected and your addNewVisitor function will be called to save the visitor details into your database
    2. The user should then be redirected to a page that says: “Thanks for the info! The following was saved to the database:”. This page should display the information that was saved, as well as the id of the new Visitor instance.

    Make use of the pug template engine to render the “Thank you” page

    Resources


    RAW CONTENT URL