koa Questions

5

Solved

I'm new to koa.js library and I need some help. I'm trying to make simple REST application using koa. I have a static html and javascript files I want to serve on route / and REST API accessing fro...
Plagiary asked 22/9, 2015 at 15:47

3

Solved

I am trying to set a cookie which has my auth token in it. I can see it being returned in the response header set-cookie: xxxxxx but for whatever reason, the browser is not storing the cookie. On ...
Dahl asked 16/5, 2018 at 11:30

4

Solved

To optimize the response delay, it is necessary to perform work after are response has been sent back to the client. However, the only way I can seem to get code to run after the response is sent i...
Chevaldefrise asked 22/10, 2014 at 20:2

4

I want to controll authentication with cookies. And In my browser working successfully. But When I tried to test with postman, Postman doesn't add cookie to new request. step - I login and respons...
Santoyo asked 29/7, 2021 at 10:8

2

Solved

I wanted to use koa & koa-bodyparser with TypeScript but whenever I access ctx.request.body I get an error that body doesn't exist on type Request import Koa from 'koa' import Router from 'koa-...
Elane asked 4/2, 2020 at 11:30

2

Solved

I have made a custom error handler for my koa app which works beautifully (except for one sticking point) - using ctx.throw() means any stacktrace is emitted to the server logs and also any custom ...
Clunk asked 3/10, 2018 at 9:15

3

Solved

Assuming I have a Koa web server with an endpoint like this: const perform = require(...); // some generator function exports.endpoint = function* () { var results = yield getResults(); // Re...
Thetisa asked 13/3, 2017 at 16:16

3

Solved

I can't believe there is no easy answer to do this. I wish to redirect let's say; www.example.com/this-url-does-not-exist to www.example.com/ There has to be a way, all the nodejs websites wi...
Missionary asked 24/3, 2015 at 21:1

5

Solved

I have created an API using io.js and koa.js. As a body parser middleware I am using koa-body, which in turn uses co-body. On one of my API endpoints I am receiving POST requests, and I need acc...
Iny asked 26/8, 2015 at 10:19

2

Solved

I am using koa, koa-passport and koa-session to log users in which works fine but when I call ctx.logout() the user can refresh and still be logged in. It seems that ctx.session and/or the cookies ...
Penitent asked 23/4, 2019 at 20:23

2

Solved

Why in the following case does koa-static fail to work with koa-router? const Koa = require("koa") const serve = require("koa-static") const Router = require("koa-router") const app = new Koa() c...
Ewing asked 21/1, 2019 at 8:12

1

In the previous version I used to get the current shop name is like this: router.get("/api/app", async (ctx) => { let shop = ctx.session.shop; }); but, in the new version, i can't ge...
Linkoski asked 20/6, 2021 at 9:22

3

Solved

I have a Koa app with a handler like this: router.get('/admin.html', function *(next) { const clientIP = "?"; this.body = `Hello World ${clientIp}`; }); where I need to acquire the client's IP...
Tergal asked 7/6, 2016 at 20:27

8

Solved

I'm trying to figure out how to split my routes into separate files. I have this so far, but it doesn't work. I just get Not found when I try to access http://localhost:3001/api/things //server.j...
Bostic asked 17/5, 2015 at 10:4

2

We are using navigator.sendBeacon function to send data to Koa server, in which we are using bodyparser. If we not wrapped data into form then by default this function send data as request payload...
Amieva asked 3/12, 2018 at 10:21

2

Solved

I'm developing node server using koa.js I have looked for some libraries for body parser. And there are several kinds of koa body parser. But I don't know what differences btw them including koa...
koa
Akerley asked 16/12, 2016 at 2:15

5

Solved

I've started playing around with Koa, but so far have been unable to find a decent solution for automatically reloading the application upon code changes. My understanding is that nodemon is the p...
Embowel asked 27/2, 2014 at 7:52

2

I'm developing a RESTful API with Node.js, Mongoose and Koa and I'm a bit stuck on what are the best practices when it comes to schemas and input validation. Currently I have both a Mongoose and J...
Fetich asked 4/4, 2019 at 8:57

3

Solved

I have a Koa app I just started and I need to test something that grabs data from a config file. I need to test with specific data, but I'm not sure how to modify what data the test receives from ...
Fakery asked 11/2, 2016 at 21:14

1

Solved

Server code: import http from 'http'; import Koa from 'koa'; import { Server } from 'socket.io'; (async () => { const app = new Koa(); var server = http.createServer(app.callback()); var io...
Flossie asked 3/12, 2020 at 20:51

4

Solved

Following official docs, I created small koa/typeorm/postgres app. When I was using createConnection with config, importing entities in the same file, app was working fine, but typeorm cli coudn't ...
Suppositive asked 23/10, 2019 at 19:41

1

Solved

I have a GraphQL powered app. The query and mutation parts work well. I try to add GraphQL subscription. The server GraphQL subscription part code is inspired by the demo in the readme of apollogr...
Transliterate asked 19/7, 2019 at 0:48

3

Solved

Usually, a logged-in user gets all entries of a Content Type. I created a "snippets" content type (_id,name,content,users<<->>snippets) <<->> means "has and belongs to ma...
Jephthah asked 12/11, 2018 at 15:42

0

I'm using the following interfaces to define my context & state for koa: export interface AppState extends Koa.DefaultState { //... } export interface AppContext extends Koa.DefaultContext { ...
Plentiful asked 9/5, 2020 at 3:0

2

Solved

So I'm trying to save an access token to the state within Koa, just for use later and saving having to pass it around the client. Following the passport oauth2 documentation for Koa, I'm strugglin...
Enyo asked 16/3, 2020 at 16:41

© 2022 - 2024 — McMap. All rights reserved.