RT Route is: koa-router A parameter is handwritten in the browser address bar, which can be obtained by the server. It is written on the a tag but reported 400 ....
const MongoClient = require( mongodb ).MongoClient; const url = mongodb: localhost:27017 ; Database Name const dbName = youyue ; var obj = {}; module.exports = async(ctx,next)=>{ const num = ctx.query.num, page = ctx.query.pag...
router.get( meibrain , async (ctx, next) => { await ctx.render( meibrain , { imgSrc: images newsbannenr.png , koa-router }) })...
require( babel-register ) const express = require( express ) const webpack = require( webpack ) const webpackConfig = require( . webpack.config ) const app = express() webpack var compiler = webpack(webpackConfig); webpack-dev-server var ...
the subject has just learned node and back-end knowledge. There was a problem when combining the previous todolist written in vue with the back-end code (login section). Front end Code-vue methods methods: { checkHasLogin () { axios.get( ...
1. First of all, get the order list through the query, and then add the user name and user password for each order object through the for loop. When I console.log, the console has output, but when I, ctx.body = {data:orderList}, the result obtained asyn...
A server built with koa2 wants to use koa-faivcon to load page logo, but it doesn t work. Does this middleware depend on anything else? < hr > Project directory is as follows: reference code is as follows: app.use(favicon(resolve( . publ...
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)...
ctx.set( Content-disposition , attachment; filename=district.csv ); ctx.set( content-type , text csv; charset=utf-8 ); ctx.statusCode = 200; ctx.body = csv; set excel to open or garbled in this way ...
for example, the front and rear separation project vue + axios + koa2 + java (springboot) uses restful style api question: what role does koa2 play? Specifically, what code should be written in koa2? Under the vue+koa2 front-end combination, where...
ctx.body = await service.get_search_data(start,count,keyword,(err,res)=>{ if(err){ return ; }else { return res; } } ) The res in the callback function can accept the data, so why can t the ctx.body accept it? ...
several interfaces are written with koa+mongodb. Cross-domain errors are always reported when requesting with ajax, even if cors is used in koa. Google has done a lot of things but still hasn t solved the problem . const cors = require( koa2-cors ); ...
question 1: why is the middleware in the koa2 framework written in the form of async, rarely in Synchronize mode (that is, without async)? For example, app.use(async (ctx, next) => { const start = new Date() await next() const ms = new Date() ...
my page uses the views layouts index.hbs template, in which there are three links corresponding to three pages. The question now is: how can I get the current path, because I want to set the active class name to the corresponding link according to t...