Initial Code Commit
This commit is contained in:
23
server/server.js
Normal file
23
server/server.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { handler } from '../build/handler.js';
|
||||
import dotenv from 'dotenv';
|
||||
import http from 'http';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import { connectDB } from './db.js';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const server = http.Server(app);
|
||||
|
||||
app.use(cors());
|
||||
|
||||
// Connect to Database
|
||||
connectDB();
|
||||
|
||||
app.use(handler);
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
server.listen(PORT, () => {
|
||||
console.log('listening on port http://localhost:' + PORT);
|
||||
});
|
||||
Reference in New Issue
Block a user