Closed ralyodio closed 2 years ago
import { multiParser } from 'https://deno.land/x/multiparser/mod.ts' import Subscriptions from '../models/subscriptions.ts'; class Controller { async post(context: any) { const body = await multiParser(context.request.serverRequest); // const existing = await Subscriptions.where('email', body.email).get() const existing = []; console.log(body); if (existing.length) { return (context.response.body = "Email already exists"); } const subscription = {}; // const subscription = await Subscriptions.create({ // id: crypto.randomUUID(), // email: body.email, // }); context.response.body = subscription; } } export default new Controller();
I get error: [uncaught oak error]: TypeError - Cannot read property 'headers' of undefined
[uncaught oak error]: TypeError - Cannot read property 'headers' of undefined
Sorry I've removed the oak support, unless the original Request is accessible from Oak
Request
see updated oak usage in https://github.com/deligenius/multiparser#with-oak
I get error:
[uncaught oak error]: TypeError - Cannot read property 'headers' of undefined