import express from 'express';
import UserRouter from './routers/user.js';
import GroupRouter from './routers/group.js';
import AbstractProductRouter from './routers/abstractproduct.js';
import log from './utils/log.js';

import config from '../config.json' with {type: "json"};
import ProductRouter from './routers/product.js';
import CategoryRouter from './routers/category.js';

const app = express();

app.use(express.urlencoded({ extended: false, limit: "200mb", parameterLimit: 100000 }));
app.use(express.json({ limit: "200mb", parameterLimit: 1000000 }));

app.use('/api/user/', UserRouter);
app.use('/api/group/', GroupRouter);
app.use('/api/abstractproduct', AbstractProductRouter);
app.use('/api/product', ProductRouter);
app.use('/api/category', CategoryRouter);

app.listen(config.port, () => {
    log.info(`Application has started on port ${config.port}`)
});