-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.ts
24 lines (18 loc) · 811 Bytes
/
server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Import the Express library to create a web server and handle HTTP requests
import express from 'express';
// Import the router module to define API routes
import { router } from './routes';
// Create an instance of an Express application
const app = express();
// Enable JSON request body parsing
app.use(express.json());
// Define the port number the server will listen on
const PORT = 3000;
// Use the imported router for routes starting with '/api'
// This means all routes in the router module will be prefixed with '/api'
app.use('/api', router);
// Start the server and listen for incoming requests on the specified port
app.listen(PORT, () => {
// Log a message to indicate that the server is running and ready to accept connections
console.log(`Server is running on port ${PORT}`);
});