bsfe_server/src/index.js

24 lines
790 B
JavaScript
Raw Normal View History

2024-10-26 05:31:22 +03:00
import express from 'express';
import UserRouter from './routers/user.js';
import GroupRouter from './routers/group.js';
import AbstractProductRouter from './routers/abstractproduct.js';
2024-10-27 05:45:12 +03:00
import log from './utils/log.js';
2024-10-26 05:31:22 +03:00
import config from '../config.json' with {type: "json"};
import ProductRouter from './routers/product.js';
2024-10-27 05:35:36 +03:00
import CategoryRouter from './routers/category.js';
2024-10-26 05:31:22 +03:00
const app = express();
app.use(express.urlencoded({ extended: true }));
2024-10-26 05:31:22 +03:00
app.use(express.json());
2024-10-26 05:31:22 +03:00
app.use('/api/user/', UserRouter);
app.use('/api/group/', GroupRouter);
app.use('/api/abstractproduct', AbstractProductRouter);
app.use('/api/product', ProductRouter);
2024-10-27 05:35:36 +03:00
app.use('/api/category', CategoryRouter);
2024-10-26 05:31:22 +03:00
app.listen(config.port, () => {
log.info(`Application has started on port ${config.port}`)
2024-10-27 05:45:12 +03:00
});