Update index.js
Browse files
index.js
CHANGED
|
@@ -132,6 +132,16 @@ app.use((req, res, next) => {
|
|
| 132 |
next();
|
| 133 |
});
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
app.post('/', async (req, res) => {
|
| 136 |
const { content, user, prompt, webSearchMode } = req.body;
|
| 137 |
if (!content) {
|
|
|
|
| 132 |
next();
|
| 133 |
});
|
| 134 |
|
| 135 |
+
// Middleware untuk mencatat detail request
|
| 136 |
+
app.use((req, res, next) => {
|
| 137 |
+
console.log(`Received ${req.method} request for ${req.url}`);
|
| 138 |
+
console.log('Request Headers:', JSON.stringify(req.headers, null, 2));
|
| 139 |
+
if (req.method === 'POST') {
|
| 140 |
+
console.log('Request Body:', JSON.stringify(req.body, null, 2));
|
| 141 |
+
}
|
| 142 |
+
next();
|
| 143 |
+
});
|
| 144 |
+
|
| 145 |
app.post('/', async (req, res) => {
|
| 146 |
const { content, user, prompt, webSearchMode } = req.body;
|
| 147 |
if (!content) {
|