随笔分类 -  nodejs

摘要:完整引入import _ from 'lodash'// 这个方式 webpack 依然会将整个库打包。import { random, debounce, findLast } from 'lodash'按需引入单独引入import debounce from "lodash/debounce"; 阅读全文
posted @ 2021-04-02 11:34 \面朝阳光/ 阅读(3128) 评论(0) 推荐(1)
摘要:1.在框架和插件中使用中间件 编写中间件 我们先来通过编写一个简单的中间件,来看看中间件的写法。 // app/middleware/middlewareOne.js // app/middleware/middlewareOne.js module.exports = (options, app) 阅读全文
posted @ 2018-12-28 23:00 \面朝阳光/ 阅读(4317) 评论(0) 推荐(0)
摘要:/* eslint-disable */ 'use strict'; const Controller = require('egg').Controller; const jwt = require('jsonwebtoken'); class LoginController extends Controller { async index() { const ctx = th... 阅读全文
posted @ 2018-12-27 00:02 \面朝阳光/ 阅读(368) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-11-05 17:07 \面朝阳光/ 阅读(0) 评论(0) 推荐(0)
摘要:'use strict';const Service = require('egg').Service;const fs = require('fs');const path = require('path');const sendToWormhole = require('stream-wormh 阅读全文
posted @ 2018-07-18 23:50 \面朝阳光/ 阅读(1027) 评论(0) 推荐(0)
摘要:有一天老大忽然问起我这个问题,nodejs运行机制 是怎样的?因自己对nodejs也不是很熟悉,就上网查了一下,得出结果如下; 1.简介 Node.js是一个事件驱动I/O服务端JavaScript环境,基于Google的V8引擎,V8引擎执行Javascript的速度非常快,性能非常好。将libu 阅读全文
posted @ 2018-06-24 13:08 \面朝阳光/ 阅读(1570) 评论(0) 推荐(1)
摘要:var http= require('http');var server= http.createServer(function(req,res){ res.writeHead(200,{"Content-type":"text/html;charset=UTF-8"}); res.end("<h2 阅读全文
posted @ 2018-01-27 17:26 \面朝阳光/ 阅读(135) 评论(0) 推荐(0)