/
alexrodionov
/
node
Обзор
Документация
Войти
/
alexrodionov
/
node
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ch06/02-basic-rendering.js
17 строк
599 B
Ethan Brown
Initial commit. Drafts through Chapter 12; still a lot of work to do!
03 июн 2019, 02:36
03 июн 2019, 02:36
e7c405f
Код
Авторство
О чём код?
const express = require('express') const expressHandlebars = require('express-handlebars') const app = express() // the following is needed to use views app.engine('handlebars', expressHandlebars({ defaultLayout: 'main' })) app.set('view engine', 'handlebars') // see the views/about.hbs file for the contents of this view app.get('/about', (req, res) => { res.render('about') }) app.get('*', (req, res) => res.send('Check out our "<a href="/about">About</a>" page!')) const port = process.env.PORT || 3000 app.listen(port, () => console.log(`\nnavigate to http://localhost:${port}/about\n`))