DASHA
This commit is contained in:
18
Маршрутизация фреймворка/app.js
Normal file
18
Маршрутизация фреймворка/app.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
// обработка запроса по адресу /about
|
||||
app.get('/about', function (request, response) {
|
||||
response.send('<h1>О сайте</h1>');
|
||||
});
|
||||
|
||||
// обработка запроса по адресу /contact
|
||||
app.use('/contact', function (request, response) {
|
||||
response.send('<h1>Контакты</h1>');
|
||||
});
|
||||
|
||||
// обработка запроса к корню веб-сайта
|
||||
app.get('/', function (request, response) {
|
||||
response.send('<h1>Главная страница</h1>');
|
||||
});
|
||||
app.listen(3000);
|
||||
Reference in New Issue
Block a user