INNER CODE UNIT · JavaScript

check_cors

guobao2333/DeepLX-Serverless · src/server.js:131

function check_cors(arg) {
  if (arg === undefined) return;
  if (typeof arg === 'string' || typeof arg === 'boolean') return arg;

  console.error("ParamTypeError: \x1b[33m'"+arg+"'\x1b[31m, origin should be Boolean or String.\n\x1b[0meg: \x1b[32m'*' or true or RegExp");
  process.exit(1);
}

function check_port(arg) {
  if (typeof arg === 'number' && !isNaN(arg) && Number.isInteger(arg) && arg >= 0 && arg <= 65535) return arg;

  console.warn('WARNING:\x1b[0m port should be >= 0 and < 65536.\nUsed default value instead: 6119\n');
  return 6119;
}

// 启动本地服务器
app.listen(PORT, () => {
  console.log(`Server is running and listening on http://localhost:${PORT}/translate`);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…