随笔分类 -  Node.js

上一页 1 2 3 4 5 6 ··· 10 下一页
摘要:There are a handful of ways you can read and write to the File System in Node.js. We will look at readFileSync, readFile, and a promise based version 阅读全文
posted @ 2022-08-05 20:25 Zhentiw 阅读(23) 评论(0) 推荐(0) 编辑
摘要:Node.js projects have two ways that you can import and export code into different files. This is through CommonJS (CJS) and ECMAScript modules (ESM). 阅读全文
posted @ 2022-08-05 19:50 Zhentiw 阅读(23) 评论(0) 推荐(0) 编辑
摘要:https://btholt.github.io/complete-intro-to-realtime/socketio https://btholt.github.io/complete-intro-to-realtime/intro-to-websockets Socket.io: FE: co 阅读全文
posted @ 2022-07-15 21:27 Zhentiw 阅读(30) 评论(0) 推荐(0) 编辑
摘要:https://btholt.github.io/complete-intro-to-realtime/intro-to-http2-push long-running HTTP call HTTP2 PUSH FE: async function getNewMsgs() { let reader 阅读全文
posted @ 2022-07-15 19:43 Zhentiw 阅读(48) 评论(0) 推荐(0) 编辑
摘要:Polling with setTimeout async function getNewMsgs() { let json; try { const res = await fetch("/poll"); json = await res.json(); } catch (e) { // back 阅读全文
posted @ 2022-07-15 19:10 Zhentiw 阅读(113) 评论(0) 推荐(0) 编辑
摘要:We'll learn how to use Next.js API Routes to hide sensitive information from the clients. In this case, we're calling the JSON Placeholder API with a 阅读全文
posted @ 2022-04-03 17:39 Zhentiw 阅读(43) 评论(0) 推荐(0) 编辑
摘要:We'll learn how to create a middleware function for next-connect. This middleware will work at the route level, for example, for every request that hi 阅读全文
posted @ 2022-04-03 17:36 Zhentiw 阅读(112) 评论(0) 推荐(0) 编辑
摘要:We'll learn an alternative way of creating API routes using the next-connect package. next-connect gives us an alternative that would feel familiar to 阅读全文
posted @ 2022-04-03 17:34 Zhentiw 阅读(38) 评论(0) 推荐(0) 编辑
摘要:Code: import {UnauthorizedError} from 'express-jwt' function errorMiddleware(error, req, res, next) { if (res.headersSent) { next(error) } else if (er 阅读全文
posted @ 2021-08-05 20:58 Zhentiw 阅读(93) 评论(0) 推荐(0) 编辑
摘要:When dealing with `fs` library, the common problem you will meet is the path to file. Different envs may have different way to handle the path. The be 阅读全文
posted @ 2021-03-29 14:47 Zhentiw 阅读(45) 评论(0) 推荐(0) 编辑
摘要:import fs from 'fs'; import Jimp = require('jimp'); // filterImageFromURL // helper function to download, filter, and save the filtered image locally 阅读全文
posted @ 2021-03-28 01:48 Zhentiw 阅读(145) 评论(0) 推荐(0) 编辑
摘要:1. Shell - Linux/Mac Users For Unix/Linux/Mac operating systems, a shell is a command-line program that accepts users' commands and executes those com 阅读全文
posted @ 2021-03-23 01:47 Zhentiw 阅读(114) 评论(0) 推荐(0) 编辑
摘要:ORMS allow us to easily switch to a different dialect of SQL (e.g. PostgreSQL, MySQL), without having to modify the code that interacts with the datab 阅读全文
posted @ 2021-03-22 15:33 Zhentiw 阅读(30) 评论(0) 推荐(0) 编辑
摘要:Intro to Object-Relational Maps (ORM) We'll be using an ORM called Sequelize to manage the connection to our database. We'll cover the basics in this 阅读全文
posted @ 2021-03-22 15:04 Zhentiw 阅读(24) 评论(0) 推荐(0) 编辑
摘要:Features and Modularity In this concept, we dive into splitting our code into logical "features". This is a way of describing modular programming wher 阅读全文
posted @ 2021-03-22 14:48 Zhentiw 阅读(25) 评论(0) 推荐(0) 编辑
摘要:We have a Netflify serverless functions which requires following packages: "devDependencies": { "playwright-aws-lambda": "^0.4.0", "playwright-core": 阅读全文
posted @ 2021-03-16 20:04 Zhentiw 阅读(73) 评论(0) 推荐(0) 编辑
摘要:Read Dependency Confusion: How I Hacked Into Apple, Microsoft and Dozens of Other Companies Yarn: yarn install –immutable --immutable-cache --checkcac 阅读全文
posted @ 2021-02-15 23:27 Zhentiw 阅读(69) 评论(0) 推荐(0) 编辑
摘要:Netlify serverless Set up a Local Development Environment for Serverless Functions Using Netlify Netlify makes developing serverless functions easy wi 阅读全文
posted @ 2021-01-26 15:36 Zhentiw 阅读(147) 评论(0) 推荐(0) 编辑
摘要:To create a virtual path prefix (where the path does not actually exist in the file system) for files that are served by the express.static function,  阅读全文
posted @ 2020-08-12 02:50 Zhentiw 阅读(100) 评论(0) 推荐(0) 编辑
摘要:routes/index.js: used for defined all the endpoints: import express from "express"; import * as notes from "./notes.js"; const router = express.Router 阅读全文
posted @ 2020-07-28 16:02 Zhentiw 阅读(207) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 10 下一页
点击右上角即可分享
微信分享提示