Questions tagged [koa]

Koa is a web framework which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs.

Koa is a web framework for Node.js, designed by the team behind Express, aiming to be a smaller, more expressive, and more robust foundation for web applications and APIs.

Use this tag if your question is about the application middleware generators and its cascading properties or the use of App.Settings. Note also the existence of the tag if you're using the middleware API with async/await.

Resources

1232 questions
-1
votes
1 answer

How add a React Component in html file with Koa-static?

I would like to create an app in koa that would render react components and serve html file. Most exactily, i want to add React in simple HTML but when i use my app i can read my html file but not my react component. I have a Koa.js…
-1
votes
1 answer

should I define one-to-many association for all relations in graphql and sequelize?

I wanna create a graphql server in NODEJS/KOA using graphql, sequelize with the Postgres database. I have a Postgres database with more than 19 tables and break all many to many relations to one-to-many. for example here one of the table(Supplier)…
-1
votes
1 answer

How to make an API using Koa.js ? If the user is not logged in, can only use 10 times. If the user successfully logs in, it can be used unlimitedly

I was ready to create an API, but I couldn't find a way to restrict users who weren't logged in.For users who have successfully logged in, I can fulfill this requirement. But for users who are not logged in, I hope he can use it 10 times for…
Amorous
  • 49
  • 6
-1
votes
1 answer

Unable to catch knex transaction rejection

I'm using knex transaction with async/await syntax as suggested in this question: Get Knex.js transactions working with ES7 async/await My problem is, that when transaction fails and trx callback is invoked, knex logs Unhandled rejection error:…
Maksymilian Tomczyk
  • 1,100
  • 8
  • 16
-1
votes
1 answer

koa restApi Cannot convert undefined or null to object

I am trying to build a simple restapi for my koa server. here is my code const Koa = require('koa'); const app = new Koa(); const json = require('koa-json') let Router = require('koa-router'); let router = new Router(); let users = [ { name:…
ilikechocolate
  • 193
  • 1
  • 12
-1
votes
1 answer

loop not working properly in node js

I am new to nodejs for loop not working synchronously. Please help thanks in advance here is my code notifyRide:function*(body){ yield User.find({_id: {$ne: body.userId}},function(err, doc){ if(doc != null){ …
siva
  • 69
  • 14
-1
votes
1 answer

JWT is not stored... How to view it?

Can't understand the nodejs Authentication (KoaJS2). I have this piece of code : router.post("/login", koaBody, (ctx, next) => { const data = ctx.request.body; db .any("SELECT * FROM users ORDER BY id ASC") .then(function(data) { …
-1
votes
2 answers

Error in async, in Koa?

I want to implement an API with POST method, But when i am starting my server then Error occured: 3450:~/Desktop/koa/ctx$ node koa2.js /home/358/Desktop/koa/ctx/koa2.js:9 router.post('/locations', async (ctx, next) =>{ …
Shubham Verma
  • 8,783
  • 6
  • 58
  • 79
-1
votes
1 answer

how to make a middleware based on koa, which is used for Intercept HTTP response?

My project base on koa,I want to intercept HTTP response,when the response's message is "no promission",then excute 'this.redirect()'.
user3387471
  • 113
  • 2
  • 5
-1
votes
1 answer

es6 support in a current node version

What es6 features can I use when I run a file with --harmony flag? Or where can I find any details about it? My versions: Cheers!
Super Babaca
  • 1,585
  • 2
  • 13
  • 15
-1
votes
1 answer

KOA POST parsing error

I'm trying to get the POST data using koa-body-parser but I get the following error : SyntaxError: Unexpected token e at Object.parse (native) This error refer to /co-body/node_modules/raw-body/index.js I think that the library co-body is trying…
-2
votes
2 answers

Chunked data transmission not working properly

I'm using content-type:chunked to transfer data in chunks, separated by \r\n, but the data received by the client is not received in chunks, but all together. How can I solve this problem? I'm currently using content-type:chunked to transfer data in…
Faye
  • 1
  • 2
-2
votes
3 answers

how to solving koa js await passing error?

const {register,login,getAll,getByID,updateUser,deleteUser} = require("../dal/user.dal"); const userRegister = (data)=>{ let user = await register(data); return user; } const loginUser = (data)=>{ let user = await login(data); …
-2
votes
1 answer

When do I see "404" in the page?

I'm a rookie in nodejs, and I'm learning Koa. I got some problem about this code. const Koa = require('koa'); const app = new Koa(); app.use(async function(ctx, next) { await next(); if (ctx.body || !ctx.idempotent) return ; ctx.status =…
-2
votes
1 answer

How integrate Nodejs and Reactjs?

I have some code on Nodejs (Koa): identification and reg users, work with DB. After successful identification or registration I wanna to transfer control to code on Reactjs, with some parameters (user info). Then call back control to nodejs. How it…
Алекс
  • 25
  • 1
  • 8
1 2 3
82
83