/
GlomyWhisper
/
TestWork
Обзор
Документация
Войти
/
GlomyWhisper
/
TestWork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
server.js
33 строки
776 B
glomywhisper
Initial commit: user service API
17 май 2026, 01:11
17 май 2026, 01:11
9cee241
Код
Авторство
О чём код?
const express = require('express'); const config = require('./config'); const initDb = require('./db/init'); const authRoutes = require('./routes/auth.routes'); const userRoutes = require('./routes/user.routes'); const errorMiddleware = require('./midlleware/error.middleware'); const app = express(); app.use(express.json()); app.get('/health', (req, res) => { res.json({ ok: true }); }); app.use('/api/auth', authRoutes); app.use('/api/users', userRoutes); app.use(errorMiddleware); async function start() { try { await initDb(); app.listen(config.app.port, () => { console.log(`Server is running on port ${config.app.port}`); }); } catch (error) { console.error('Cannot start server:', error.message); process.exit(1); } } start();