Summary of Problem
Receiving : Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Timeout when trying to run a test with Jest and supertest.
Specs
Koa2 project, Jest/Supertest testing, Babel 7.9.0…
I'm currently coding the manual setup of authenticating a Shopify app, similar to how they set it up in NodeJS and Express. For the application, I'm using NodeJS and the Koa framework. I'm also using @koa/router for routing and attempting to use…
I have just started with the Koa and made a basic setup with the following code
const Koa = require('koa');
const app = new Koa();
// logger
var port = process.env.PORT || 8080; // set our port
// response
app.use(async ctx => {
…
I have the following endpoint
@Patch("/games/:id")
@HttpCode(200)
async updateGame(@Param("id") id: number, @Body() update: Partial) {
const updatedGame = await Game.findOne(id);
if (!updatedGame){
throw new…
In app.js, I have some code like following
const Router = require('koa-router')
let enpackage = new Router()
enpackage.get('/en', async ( ctx )=>{
ctx.redirect('/')
})
let router = new Router()
router.use('/en', enpackage.routes(),…
I really need help with a pretty simple and trivial problem, but here it goes. I am using marko on the server side in NodeJS and am rendering my views via:
ctx.render({
});
with koa-router and koa. I need help in the html dept on how to go about…
I'm trying to build a simple REST API with Koa. For this, I am using koa-router. I have two problems:
Whenever I try to add parameters to my POST-Method in mainRouter.ts like ":id", Postman shows a "not found". My request:…
I'm pretty sure It's because ctx.render function is just for rendering page, but I have no idea what to do to do what I'm tryna do.
Basically, I'm trying to redirect user to user's mypage after login, with jwt token in the header so I used axios to…
Background
I am using koa2 with some middlewares to build a basic api framework. But when I use "ctx.body" to send response in my router, the client side always receive "Not Found"
My code
./app.js
const Koa = require('koa');
const app = new…
I'm using koa-joi-validator in KOA js.
JOI validation works properly for GET method. But when POST method triggers it just receives the request and that's it, No validation triggered, No response sent.
GET
<-- GET /user/1
--> GET /user/1 200 107ms…
I'm starting devel on very small app, and decided to use koa Framework with koa-router ( among some other middleware in the future)
Question is that after specifying my routes, a strange catch-all, no method, no url route appears
// excerpt of…
Trying to implement a local Passport strategy in Koa 2 but I'm missing something vital...
When my route hits passport.authenticate(), I'm able to retrieve my user but I'm never returning from that await(), so my code doesn't progress any…
In code bellow, I would like that somehow changed commented part should be able to set document's body instead of "this.body = 'test';" (it still should be Promise solution).
'use strict'
var app = require('koa')(),
router =…
In my Koa app, I've this kind of router :
app
.use(router(app))
.all('/', frontRoutes.home.index);
My problem is that :
mydomain.com
mydomain.com/
mydomain.com?
Are routed by the same route. It could be great but for Google it's not. Says…
I have an application build with koa and koa-router. When testing routes with supertest I face a problem, that content-type response header is always application/json; charset=utf-8.
const app = koa();
router
.get('/img', function *(next) {
…