js Sleep函数 和 compression(请求压缩)

function sleep(interval) {
  return new Promise(resolve => {
    setTimeout(resolve, interval);
  })
}
async function test() {
  for (let index = 0; index < 10; index++) {
    console.log(index);
    await sleep(2000)
  }
}

Node

开启 Gzip
const express = require('express');
const compression = require('compression');
const app = express();
app.use(compression());


 

你可能感兴趣的:(javascript,node)