code screenshot beautify plugin & 代碼截圖美化插件


code screenshot beautify plugin & 代碼截圖美化插件

代碼截圖美化

codesnap

微信分享代碼截圖

https://github.com/kufii/CodeSnap

demo


"use strict";

/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright xgqfrms
 * @created 2020-10-01
 * @modified
 *
 * @description
 * @difficulty Easy Medium Hard
 * @complexity O(n)
 * @augments
 * @example
 * @link
 * @solutions
 *
 * @best_solutions
 *
 */

const log = console.log;

const Koa = require('koa');
const app = new Koa();

const port = 3000;

// logger
app.use(async (ctx, next) => {
  log(`🔖 1`)
  await next();
  log(`🔖 2`)
  const rt = ctx.response.get('X-Response-Time');
  log(`${ctx.method} ${ctx.url} - ${rt}`);
});

// x-response-time
app.use(async (ctx, next) => {
  const start = Date.now();
  log(`🔖 3`)
  await next();
  log(`🔖 4`)
  const ms = Date.now() - start;
  ctx.set('X-Response-Time', `${ms}ms`);
});

// response
app.use(async ctx => {
  log(`🔖 5`)
  ctx.body = 'Hello World';
});

app.listen(port);


/*


Promise 先后順序, async/await

🔖 1
🔖 3
🔖 5
🔖 4
🔖 2
GET /?q=xgqfrms - 2ms
🔖 1
🔖 3
🔖 5
🔖 4
🔖 2
GET /favicon.ico - 0ms

*/


自定義配置

Carbon

Carbon | Create and share beautiful images of your source code

https://carbon.now.sh/

https://github.com/carbon-app/carbon

refs



©xgqfrms 2012-2020

www.cnblogs.com 發布文章使用:只允許注冊用戶才可以訪問!



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM