-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (21 loc) · 923 Bytes
/
Copy pathapp.js
File metadata and controls
31 lines (21 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Project: amzone-api-scraper :: Created Date: 2023-10-01
import express from 'express';
import productRoutes from './routes/productRoutes.js'; // Ensure this import is present
import cors from 'cors';
import { config } from './config/config.js'; // import the config object from the config.js file
import swaggerUi from 'swagger-ui-express';
import YAML from 'yamljs';
import pingRoutes from './routes/ping.js'; // import the ping routes
const app = express(); // create an instance of express
const swaggerDocument = YAML.load('./doc/openAPI.yaml');
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
app.use(cors());
app.use(express.json());
app.use('/ping', pingRoutes);
app.use('/api', productRoutes);
app.get('/', (req, res) => {
res.send('Welcome to the Amzone API Scraper!');
});
app.listen(config.port, () => {
console.log(`Server is running on port ${config.port}`);
});