-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (21 loc) · 826 Bytes
/
index.js
File metadata and controls
28 lines (21 loc) · 826 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
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
app.post('/api/toyProductionKey', (req, res) => {
// Extract the key from the request body
const test = req.body;
// console.log(req.body)
// Log the received key to the console (useful for debugging)
console.log('Received key:', test);
// Check if the key exists and send a response
// if (!key) {
// return res.status(400).json({ error: 'Key is required' }); // Send a 400 Bad Request if key is missing
// }
// Send a success response with the received key
res.status(200).json({ message: 'Key received successfully', receivedKey: test });
});