How to generate a link that can be accessed directly after the picture is uploaded to the server

I upload the avatar on the client side, and the picture is uploaded to the server and saved in a fixed folder. Now how do I read this picture on the client side?

the running environment is the backend is node koa

related codes

exports.editcover = async (ctx) => {
  const {
      userId,
      imgfile
  } = ctx.request.body
  var base64Data = imgfile.replace(/^data:image\/\w+;base64,/, "");
  var dataBuffer = new Buffer(base64Data, "base64");
  let name = new Date().getTime().toString() + OrderHelper.generateRondom(10).toString();
  let url =  "./upload/"+name+".png"
  fs.writeFile(url, dataBuffer, function(err) {
 if(err){
   console.log("");
 }else{
   console.log("");
   console.log(url);//upload
 }
 });
}

I want to know how to generate a picture link and save it to the database. After the client can access the file in upload on my server through the picture link, please, my novice front end, if the description is wrong, please forgive me.

Feb.15,2022

assume that the file save path is / data/upload

if you have a static server such as nginx , add a configuration to point to the upload folder, and then access the file via domain name + path , such as

.
server {
        listen  80;
        server_name test.com;
        root   /home/www/html/test.com;

        -sharp  https://img.codeshelper.com/upload/img/2022/02/15/lxloa5ex0ah3179.png  /data/upload/a.png
        location /upload/ {
            root /data/upload;
        }

if you are using koa to start the http server, use koa-send to access static resources

router.post('/upload/:filename', async (ctx){
    const name = ctx.params.filename;
    const fullpath = `/data/upload/${filename}`;
    ctx.attachment(fullpath);
    await send(ctx, fullpath);
)}
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-1b3ac2c-2b5a1.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-1b3ac2c-2b5a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?