mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-05 09:35:42 -05:00
Initial commit of calendar service
This commit is contained in:
27
Calendar/Service/src/app.ts
Normal file
27
Calendar/Service/src/app.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'dotenv/config';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import helmet from 'helmet';
|
||||
import { eventsRouter } from './events/events.routes';
|
||||
|
||||
if (!process.env.PORT) {
|
||||
console.log('No port value specified');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.env.TZ = 'Etc/UTC';
|
||||
|
||||
const PORT = parseInt(process.env.PORT as string, 10);
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use(cors());
|
||||
app.use(helmet());
|
||||
|
||||
app.use('/events/', eventsRouter);
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is listening on port ${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user