Category : koa

I use ejs to write the web page. But when i use for will have something wrong code Use for of can work But use for loop will fail I don’t know this different… <% for(post of posts){ %> <div class="layout-card p-5 mb-5"> <h3 class="h3"><%= post.Title %></h3> <div class="text-muted mb-3"><small> <i class="fas fa-calendar-alt mr-2"></i> Create ..

Read more

I am building a simple server on Javascript using node.js platform. I have 2 files which are called server.js and db.js. I found a weird error while testing server.js. Below you’ll find the 3 files in question. Any and all answers are greatly appreciated! Error on node C:UsersCharu NasaFinsectradebackendnode_modulespath-to-regexpdistindex.js:48 throw new TypeError("Missing parameter name at ..

Read more

I am trying to make a post request to a 3rd party api from my koa-js api. Here is my code let saveUserResponse = await ctx.post(url, ctx.request.body, { ‘User-Agent’: ‘koa-http-request’, ‘content-type’: ‘application/json’, }); I am getting a 400 response code from that. I suspect that the body of my request is not being sent properly. ..

Read more

Koa body-parser uses formidable to parse the various media types for form data. For multipart/form-data, multipart_parser calls formidable with the parts of the multipart form data, which then writes it to disk and reports the created files in ctx.request.files. My app parses and uses the uploaded data, whether it arrives in multipart/form-data, form-url-encoded, or whatever. ..

Read more