because it is time-consuming to run, you need to return a result first. Is there any way for koa to implement other operations?
because it is time-consuming to run, you need to return a result first. Is there any way for koa to implement other operations?
you mean asynchronous requests?
"other operations" without await.
return first, what is the meaning of your next operation?
Previous: What's the difference between html5 live video and ordinary video?
Next: WeChat Pay, issue the IP address of ordinary red packet.
I would like to ask you bosses about the problems in the direction of learning how to learn Node has always been my doubt. The blogs and tutorials I read on the Internet are all about learning several core modules of Nodejs (fs,path,event,buffer,http)...
the middle tier I started with node (koa) has a lot of timeouts from the very beginning. I wrote the timeout control myself. At first, I wrote the timeout, then the request grew, the timeout also increased, and finally I reached several hours, and then I...
is there any difference below? controllers async function get (ctx, next) { const res = await models.test.get() ctx.state.data = res.data ******* ******** ctx.body = res.data await next() } module.exports = { ge...
using koa2 s middleware, I want to implement an interceptor in order to perform some processing on all requests. The code is as follows: when visiting , the middleware is executed and and 1111 are printed at the terminal, but the page shows tha...
the server uses koa , uses pug template engine, and renders the template in the way of ctx.render ( layout , data) ). How to refresh the front-end page automatically after changing the front-end pug , less , js files? ...
const LocalStrategy = require( passport-local ).Strategy passport.use(new LocalStrategy(async function (username, password, done) { FK: username let user = await userStore.getUserByName(username) FK: passwordhash if (user && valid...
When is returned to the front-end status code, is the front-end status code given according to the judgment of the back-end itself? Is there still some official way? For beginners to learn the back end, please let me know async selectData(ctx) { ...
recently, I learned the node.js + koa + mysql backend. When I write a page, I always see that the requested interface has some string-based unique Id,. I don t know how to do it myself. Please give me some advice ....
Startup file app.js let cookie = { maxAge: new Date().getTime() + 3*24*3600*1000, cookie expires: new Date().getTime() + 3*24*3600*1000, cookie path: , cookie domain: 127.0.0.1 , cookie httpOnly: true, http ...
learn node+koa developer is writing a simple example and using token app.use(jwtKoa({secret}).unless({ path: [ ^ adduser , ^ login ] jwt })) when you log in, return to the frontend token and set it to be valid for one hour, but if the token...
1. After logging in for the first time, return to the front-end token, and then the front-end takes the token to get the corresponding data 2. When you log in for the second time, you don t need to enter the account password again and jump directly to...
set to use token and url, that does not require verification to successfully return to the front end token using login app.js const jwtKoa = require( koa-jwt ); app.use(jwtKoa({secret}).unless({ path: [ adduser , login ] jwt })) but wit...
the concept of middle layer has been put forward for a long time, but there has been no practical operation. I have written a personal website with koa, so there is a certain foundation. Using the middle layer can mainly reduce the energy consumption of ...