|
@@ -11,11 +11,11 @@ const server = http.createServer((req, res) => {
|
|
|
|
|
|
|
|
req.on('end', () => {
|
|
req.on('end', () => {
|
|
|
try {
|
|
try {
|
|
|
- const parsedBody = JSON.parse(body);
|
|
|
|
|
- console.log ("not parsed")
|
|
|
|
|
- console.log(body)
|
|
|
|
|
- console.log("parsed")
|
|
|
|
|
- console.log(parsedBody)
|
|
|
|
|
|
|
+ // const parsedBody = JSON.parse(body);
|
|
|
|
|
+ // console.log ("not parsed")
|
|
|
|
|
+ // console.log(body)
|
|
|
|
|
+ // console.log("parsed")
|
|
|
|
|
+ // console.log(parsedBody)
|
|
|
|
|
|
|
|
const customMessage = {
|
|
const customMessage = {
|
|
|
"cnl": "NBDS",
|
|
"cnl": "NBDS",
|
|
@@ -51,6 +51,7 @@ const server = http.createServer((req, res) => {
|
|
|
// res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
// res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
|
// res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
// res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
|
|
+ console.log(error);
|
|
|
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
|
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
|
}
|
|
}
|