diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..f9d980f --- /dev/null +++ b/public/index.html @@ -0,0 +1,52 @@ + + + + + + + + Request Demo + + +

Request Demo

+ +

Basic POST Form

+
+ + +
+ +

Basic AJAX Form

+
+ + +
+ + + + diff --git a/src/index.js b/src/index.js index eed1693..12c749a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ const express = require('express'); const cors = require('cors'); +const fs = require('fs/promises'); const PORT = process.env.PORT || 8080; @@ -9,6 +10,14 @@ app.use(cors()); app.use(express.json()); app.use(express.urlencoded({ extended: false })); +app.get('/form', async (req, res) => { + const html = await fs.readFile('public/index.html'); + + res.setHeader('Content-Type', 'text/html'); + res.send(html); + res.end(); +}); + app.use(function (req, res) { const info = { method: req.method,