Start setting up FORM parser

This commit is contained in:
Dave Smith-Hayes 2024-02-20 21:29:10 -05:00
parent d8bf0cfbd1
commit bedff8c0f5
3 changed files with 5 additions and 8 deletions

View File

@ -26,7 +26,7 @@ app.onError((err: Error, c: Context) => {
} }
return c.json({ message: "An error occurred." }); return c.json({ message: "An error occurred." });
}) });
// //
// set routes // set routes
@ -57,5 +57,4 @@ app.get('/:channel', (c: Context) => {
// feed actions // feed actions
console.log("Running app on :3000");
export default app; export default app;

View File

@ -2,12 +2,10 @@ import { Context } from 'hono';
export default async function parsedForm(c: Context, next) { export default async function parsedForm(c: Context, next) {
if (c.req.method == 'POST') { if (c.req.method == 'POST') {
if (c.req.header('Content-Type') == 'application/json') { if (c.req.header('Content-Type') === 'application/x-www-form-urlencoded') {
next();
} else {
} }
} }
next();
} }

View File

@ -14,7 +14,7 @@ app.post('/register', async (c: Context) => {
try { try {
const results = await conn.query(query, [ const results = await conn.query(query, [
user.username, user.email,
user.name, user.name,
user.password user.password
]); ]);