Saturday 29 April 2017

nodejs: Koa , form in pug gives undefined

I have a form in pug with just one input

form(action="/" method="POST")
 label Enter URL to shorten
 br
 input(name="url" type="url") 
 button(type="submit") Submit

I use koa-pug to get the input

async function handleForm (ctx) {
   console.log(ctx.request.body);
}

However this logs undefined

I also use koa-body as body parser

app.use(body());



via furball514

No comments:

Post a Comment