Skip to content

Instantly share code, notes, and snippets.

@james-fourth
Created October 31, 2019 00:10
Show Gist options
  • Save james-fourth/e7110e97f33b5df1f0de0b6f30b57b98 to your computer and use it in GitHub Desktop.
Save james-fourth/e7110e97f33b5df1f0de0b6f30b57b98 to your computer and use it in GitHub Desktop.
Affirm Technical Screen
const express = require("express");
const bodyParser = require("body-parser")
const ejs = require("ejs");
const app = express();
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({extended: true}));
app.get("/", function(req, res) {
res.render("index");
})
app.post("/", function(req, res) {
console.log(req.body);
const options = {
host: url,
port: 80,
path: '/resource?id=foo&bar=baz',
method: 'POST'
};
http.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
})
})
app.listen(3000, function() {
console.log("Server listening on port 3000")
})
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="credit-card-form">
<form class="" action="/" method="post">
<input type="text" name="name" placeholder="Name">
<input type="text" name="number" placeholder="Card Number">
<input type="text" name="cvv" placeholder="CVV2">
<input type="text" name="exp-month" placeholder="Exp. Month">
<input type="text" name="exp-year" placeholder="Exp. Year">
<button type="submit" name="button">Submit</button>
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment