This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const port = 3000 | |
const fs = require('fs') | |
app.use(express.json()) | |
app.use(express.urlencoded({ extended: true })) | |
let counter = 0 | |
app.post('/', (req, res) => { | |
fs.writeFile(`response${counter}.json`, JSON.stringify(req.body), (err) => { | |
if (err) { | |
console.log("something happened saving the file") | |
} | |
counter++ | |
console.log("body response was saved!") | |
}) | |
res.status(200) | |
}) | |
app.listen(port, () => console.log(`Running`)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment