feat: server html form

This commit is contained in:
Joe Fleming
2021-07-23 16:03:41 -07:00
parent e0d1f50710
commit 7b7eb4db7f
2 changed files with 61 additions and 0 deletions

View File

@@ -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,