bAILEYB
Denoβ€’15mo agoβ€’
4 replies
bAILEY

Basic CRUD API

Hi all, I'm trying to move from Node/Express and so I'm trying to use Deno/Oak for this, as I've heard Oak is pretty good. It's not going so well, I'm trying to create a basic post request for a user account creation but I'm struggling to find documentation on how to do this.

 router.post("/register", async (ctx) => {

    const body = await ctx.request.body({type: 'json'}).value()
    const value = await body.value
    console.log(value)

   // const username = user.value.get('username')
//   console.log(user.get('username'))
})


This is some of the stuff I've tried so far but I keep getting different errors such as ctx.request.body is not a function, [uncaught application error]: BadRequestError - Unexpected end of JSON input etc

Any help and/or pointers to correct documention would be really helpful, thanks! :D
Was this page helpful?