随笔分类 - nodejs
摘要:完整引入import _ from 'lodash'// 这个方式 webpack 依然会将整个库打包。import { random, debounce, findLast } from 'lodash'按需引入单独引入import debounce from "lodash/debounce";
阅读全文
摘要:1.在框架和插件中使用中间件 编写中间件 我们先来通过编写一个简单的中间件,来看看中间件的写法。 // app/middleware/middlewareOne.js // app/middleware/middlewareOne.js module.exports = (options, app)
阅读全文
摘要:/* eslint-disable */ 'use strict'; const Controller = require('egg').Controller; const jwt = require('jsonwebtoken'); class LoginController extends Controller { async index() { const ctx = th...
阅读全文
摘要:'use strict';const Service = require('egg').Service;const fs = require('fs');const path = require('path');const sendToWormhole = require('stream-wormh
阅读全文
摘要:有一天老大忽然问起我这个问题,nodejs运行机制 是怎样的?因自己对nodejs也不是很熟悉,就上网查了一下,得出结果如下; 1.简介 Node.js是一个事件驱动I/O服务端JavaScript环境,基于Google的V8引擎,V8引擎执行Javascript的速度非常快,性能非常好。将libu
阅读全文
摘要:var http= require('http');var server= http.createServer(function(req,res){ res.writeHead(200,{"Content-type":"text/html;charset=UTF-8"}); res.end("<h2
阅读全文

浙公网安备 33010602011771号