/
erioxis
/
web-nodejs
Обзор
Документация
Войти
/
erioxis
/
web-nodejs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/node_modules/fastify/integration/server.js
29 строк
644 B
erioxis
lab11fix
15 дек 2025, 23:21
15 дек 2025, 23:21
70dc7ba
Код
Авторство
О чём код?
'use strict' const Fastify = require('../fastify') const fastify = Fastify() fastify.listen({ host: '::', port: 3000 }) fastify.get('/', async function (request, reply) { reply.code(200).send({ data: 'home page' }) }) fastify.post('/post/:id', async function (request, reply) { const { id } = request.params reply.code(201).send({ data: `${id}` }) }) fastify.put('/put/:id', async function (request, reply) { const { id } = request.params reply.code(200).send({ data: `${id}` }) }) fastify.delete('/delete/:id', async function (request, reply) { const { id } = request.params reply.code(204).send({ data: `${id}` }) })