This commit is contained in:
lab
2023-10-25 09:08:45 +03:00
commit 088bcdc4a6
109 changed files with 10821 additions and 0 deletions

18
27/app.js Normal file
View File

@@ -0,0 +1,18 @@
const express = require('express');
const app = express();
// создаем парсер для данных в формате json
const jsonParser = express.json();
app.post('/user', jsonParser, function (request, response) {
console.log(request.body);
if (!request.body) return response.sendStatus(400);
response.json(request.body); // отправляем пришедший ответ обратно
});
app.get('/', function (request, response) {
response.sendFile(__dirname + '/index.html');
});
app.listen(3000);