-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); |