Created
September 20, 2022 03:43
-
-
Save Octagon-simon/04434f820efe91da9f5459a969965133 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //import express | |
| const express = require('express') | |
| //import ejs | |
| const ejs = require('ejs') | |
| //load express | |
| const app = express() | |
| //set port number | |
| const port = 5000 | |
| //tell express to use ejs as our template/view engine | |
| app.set('view engine', 'ejs') | |
| //tell express to use pages as our views directory | |
| app.set('views', './pages') | |
| //route to homepage | |
| app.get( '/', (req, res) => { | |
| //render the template for the homepage | |
| res.render('home'); | |
| }) | |
| //listen on the port number | |
| app.listen(port, () =>{ | |
| console.log("App is live") | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment