-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (25 loc) · 835 Bytes
/
index.js
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
const express = require('express');
const path = require('path');
const app = express();
// Middleware to log request info
app.use((req, res, next) => {
console.log('Request Info:');
console.log(`Method: ${req.method}`);
console.log(`URL: ${req.url}`);
console.log(`Headers: ${JSON.stringify(req.headers)}`);
console.log(`Body: ${JSON.stringify(req.body)}`);
// Pass control to the next middleware or route
next();
});
// Route to serve the image for any path starting with /aws.jpeg
app.get('/aws.jpeg', (req, res) => {
res.sendFile(path.join(__dirname, 'aws.jpeg'));
});
app.get('/aws.jpeg/*', (req, res) => {
res.sendFile(path.join(__dirname, 'aws.jpeg'));
});
// Start the server
const port = 3000;
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});