fix DB table creation, remove log line

This commit is contained in:
martin-mfg
2025-06-25 17:21:33 +00:00
parent 47e8886d96
commit 81d7efaf2b
2 changed files with 3 additions and 15 deletions
@@ -2,6 +2,7 @@ import { default as gist } from "./api/gist.js";
import { default as pin } from "./api/pin.js";
export default async (req, res) => {
// remaining code expects express.js-like request and response objects
res.send = function (data) {
if (typeof data === "object") {
res.setHeader("Content-Type", "application/json");
@@ -17,20 +18,6 @@ export default async (req, res) => {
const url = new URL(req.url, "https://localhost");
req.query = Object.fromEntries(url.searchParams.entries());
console.log(
JSON.stringify(req.query) +
" # " +
req.method +
" # " +
JSON.stringify(req.headers) +
" # " +
res.setHeader +
" # " +
res.send +
" # " +
res.status,
);
switch (url.pathname) {
case "/gist":
gist(req, res);
+2 -1
View File
@@ -39,7 +39,8 @@ export async function storeRequest(req) {
const createTableQuery = `
CREATE TABLE IF NOT EXISTS requests (
request TEXT PRIMARY KEY,
requested_at TIMESTAMP NOT NULL DEFAULT now()
requested_at TIMESTAMP NOT NULL DEFAULT now(),
user_requested_at TIMESTAMP NOT NULL DEFAULT now()
)
`;
await pool.query(createTableQuery);