Start setting up FORM parser
This commit is contained in:
parent
d8bf0cfbd1
commit
bedff8c0f5
@ -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;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user