Skip to content

Instantly share code, notes, and snippets.

View benzapier's full-sized avatar

benzapier

View GitHub Profile
@benzapier
benzapier / return200.js
Last active November 30, 2018 22:01
Simple webserver that runs and replies with a `200` response to any "GET" or "POST" request.
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const printRequest = (req) => {
const now = new Date();
console.log(now, now.getTime());
@benzapier
benzapier / return200.js
Last active November 18, 2019 23:01
Simple webserver that runs and replies with a `200` request to anything/everything.
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
// https://stackoverflow.com/questions/50908120/
const rawBodySaver = function (req, res, buf, encoding) {
if (buf && buf.length) {
req.rawBody = buf.toString(encoding || 'utf8');
}
}