May I ask axios, how to encrypt the api interface at the front end?

ask axios, how to encrypt the api interface at the front end

Mar.30,2022

just encrypt the request parameters.. Is it difficult


parameters can be encrypted

param2String = data => {
   if (typeof data === 'string') {
       return data;
   }
  let ret = '';
  for (let it in data) {
      let val = data[it];
      if (typeof val === 'object' && (!(val instanceof Array) || (val.length > 0 && (typeof val[0] === 'object')))) {
         val = JSON.stringify(val);
      }
      ret += it + '=' + encodeURIComponent(val) + '&';
  }
  if (ret.length > 0) {
      ret = ret.substring(0, ret.length - 1);
  }
 return ret;
};

and then decode it in the background


you can use the js-md5 library to encrypt parameters.


General processing can be done using md5 or RAS encryption

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-1e889ca-ef3.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-1e889ca-ef3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?