How does node+koa return the front-end status code?

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) {
       let data = ctx.request.body
        let userAddParams = [data.oid,data.uid,data.name,data.buytime];
        if(Object.keys(data).length > 0) {
            try {
                await query(insert, userAddParams);
                ctx.response.body = {
                  status: 200,
                  description: "ok",
                  result: data
                }
              } catch(err) {
                    ctx.response.body = {
                        status: 404
                    }
              }
          }
      }
Apr.03,2021

the backend gives the status code judgment to the front end itself.
can also be written in this way.

ctx.status=304;


ctx.status = 200 ctx.status set the response directly
ctx.body = 'abc' ctx.body directly set the response body.

ctx is koa's context object that integrates request and response. On this ctx context object, koa provides many convenient manipulation methods and logic.

https://koa.bootcss.com/-sharpcont., although I'd like to complain about this koa2 website.


ctx.status 

ctx.body.status

ctx.response.body.status

ctx.response.status
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36b79-2b7b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36b79-2b7b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?