Coder Social home page Coder Social logo

first-ejs-express-lab-abp-11-17's Introduction

Your First Express App Lab

Objectives

  1. Draw a route to a GET '/'
  2. Render views/index.ejs as a response.
  3. Pass data from the route callback to the view.
  4. Use data from the route callback in the view.

Instructions

Just to be safe, before starting the tests or the server, run npm install in your terminal.

You can run the tests with learn.

To start your application, type npm start. The IDE will give you an IP address and port for your application, locally, your application will be running at http://localhost:3000.

GET '/' Route

In app.js, define a route for the root of the application at /. In the callback for that route, you will be rendering a template inside the views directory called index.ejs using resp.render().

Your route callback should also pass a javascript object to the view with a key welcomePhrase that has a value of Hello, World from Express and EJS!.

Finally, make sure you use embedded EJS with <%= %> to write the value of welcomePhrase into the HTML. Add an <h2> below the <h1> and write the contents of the variable as the text of the <h2>

first-ejs-express-lab-abp-11-17's People

Contributors

aviflombaum avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.