Skip to content

Commit

Permalink
chore: update the server.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed May 14, 2024
1 parent 34f3504 commit ac3d428
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions apps/api/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import logger from '@hey/helpers/logger';
import cors from 'cors';
import * as dotenv from 'dotenv';
import dotenv from 'dotenv';
import express from 'express';
import { router } from 'express-file-routing';
import ViteExpress from 'vite-express';

// Load environment variables
dotenv.config({ override: true });

const app = express();

// Middleware configuration
app.use(cors());
app.disable('x-powered-by');

(async () => {
const setupRoutes = async () => {
// Route configuration
app.use('/signup', express.raw({ type: 'application/json' }), await router());
app.use('/', express.json({ limit: '1mb' }), await router());

ViteExpress.listen(app, 4784, () =>
logger.info('Server is listening on port 4784...')
);
})();
// Start the server
ViteExpress.listen(app, 4784, () => {
logger.info('Server is listening on port 4784...');
});
};

// Initialize routes
setupRoutes().catch(() => {
logger.error('Error setting up routes');
});

0 comments on commit ac3d428

Please sign in to comment.