import Koa from 'koa';
import logger from '~/modules/logger';
import router from '~/modules/router';

const DEFAULT_PORT = 3000;

const { env: { PORT } } = process;

const app = new Koa();

const port = PORT ?? DEFAULT_PORT;

app
	.use(router.routes())
	.use(router.allowedMethods());

app.listen(port, () => {
	logger.success(`App listening on port ${port}`);
});
