POST handling start
parent
eae35f15f1
commit
8c32b48610
@ -1,7 +1,17 @@
|
||||
const express = require("express")
|
||||
const fs = require('fs')
|
||||
|
||||
const app = express()
|
||||
const PORT = process.env.PORT || 8997
|
||||
|
||||
app.use(express.static("public"))
|
||||
app.use(express.json())
|
||||
|
||||
app.post('/', function requestHandler(req,res) {
|
||||
fs.appendFile('./database.txt', req.body.toString() + "\n")
|
||||
|
||||
}
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue