Await call has no effect in node

WeChat Mini Programs who uses node at the back end. Await mysql"s asynchronous method with no return value written in getRoom looks like an asynchronous error, but it can be run in the main function. What is the reason for this? if you want to write in getRoom, how to change
code A can run

const { mysql } = require("../qcloud")
    var index =  async (ctx, next)=>  {
      let data = ctx.request.body
      switch (ctx.request.body.fun) {
        case "add": add(ctx, next); break;
        case "getRoom": getRoom(ctx,next);break;
        default: err(ctx, next); break;
      }
     
      await mysql("aaa").select().from("room").then((back) => { ctx.state.data = { msg: back } })
    }

    var getRoom =  (ctx,next)=>{

   }

module.exports = { index: index }

Code B has no return value

const { mysql } = require("../qcloud")
    var index =  async (ctx, next)=>  {
      let data = ctx.request.body
      switch (ctx.request.body.fun) {
        case "add": add(ctx, next); break;
        case "getRoom": getRoom(ctx,next);break;
        default: err(ctx, next); break;
      }
     
     
    }

    var getRoom =  async(ctx,next)=>{
      await mysql("aaa").select().from("room").then((back) => { ctx.state.data = { msg: back } })
   }

module.exports = { index: index }
Mar.11,2021

now that getRoom is already an async, you need await when calling it

Menu