Skip to content

Instantly share code, notes, and snippets.

@deer-roy
Created June 27, 2025 07:44
Show Gist options
  • Save deer-roy/0c67526a576ab78740052bb69c42c8d3 to your computer and use it in GitHub Desktop.
Save deer-roy/0c67526a576ab78740052bb69c42c8d3 to your computer and use it in GitHub Desktop.
const cors = require('cors')
const express = require('express');
const { json, urlencoded } = require('express');
const { path } = require('fs')
const app = express()
const port = 8080
app.use(cors())
app.use(json()) // for parsing application/json
app.use(urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
app.all('/', (req, res) => {
console.log('post body =>', req.body)
console.log('query =>', req.query)
console.log('headers =>', req.headers)
})
function onServe() {
console.log(`Example app listening on port ${port}`)
}
//serve without https
app.listen(port, onServe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment