Files
lab5dasha/Маршрутизация фреймворка/app.js
2023-11-08 14:02:38 +03:00

19 lines
587 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);