随笔分类 -  Node.js

上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要:In this lesson we'll build a basic web server in 2 minutes using Express 5 and node 14's native ES module support. We'll start by creating a new proje 阅读全文
posted @ 2020-07-27 21:08 Zhentiw 阅读(122) 评论(0) 推荐(0) 编辑
摘要:When express App run syncronous code: app.get("/test", (req, res) => { throw new Error("Oh no! The world has ended!"); }); Those code works fine. But 阅读全文
posted @ 2020-07-27 16:05 Zhentiw 阅读(169) 评论(0) 推荐(0) 编辑
摘要:Mirage JS lets you mock out production APIs directly alongside your frontend React code. You can tweak the data or force a network request to hang, so 阅读全文
posted @ 2020-05-28 14:55 Zhentiw 阅读(238) 评论(0) 推荐(0) 编辑
摘要:In package.json file: "prepare": "npm run build", "postpublish": "git push --tags", "prepare": make sure we don't forget to run build before publish t 阅读全文
posted @ 2020-05-04 18:54 Zhentiw 阅读(170) 评论(0) 推荐(0) 编辑
摘要:For example we have a rest endpoint, we need to validate the data we receive in correct format: import { IsMongoId, IsString, IsBoolean, IsInt } from 阅读全文
posted @ 2020-02-04 14:57 Zhentiw 阅读(1313) 评论(0) 推荐(0) 编辑
摘要:Fallback exception filter is mean to catch any exception which are not catched by other exception filters; main.ts: Order matters, from most generic t 阅读全文
posted @ 2020-01-15 14:29 Zhentiw 阅读(303) 评论(0) 推荐(0) 编辑
摘要:Throw expection from Controller: Expection types: https://docs.nestjs.com/exception-filters#built-in-http-exceptions We can create global reuseable ex 阅读全文
posted @ 2020-01-13 14:28 Zhentiw 阅读(433) 评论(0) 推荐(0) 编辑
摘要:main.ts Module: Schema: Controller: Repository: 阅读全文
posted @ 2020-01-12 19:51 Zhentiw 阅读(758) 评论(0) 推荐(0) 编辑
摘要:Before we publish our package, we want to make sure everything is set up correctly. We’ll cover versioning, preparing our package, adding a proper REA 阅读全文
posted @ 2019-11-04 16:54 Zhentiw 阅读(184) 评论(0) 推荐(0) 编辑
摘要:For example we have a function to check the filesize: It works fine, but the 'fileSize' function has a problem, those part of code run in sync, not as 阅读全文
posted @ 2019-03-28 21:40 Zhentiw 阅读(273) 评论(0) 推荐(0) 编辑
摘要:We will see how you can use npx to pull and execute code from a GitHub repository. If you need even more control, you can target a specific branch of 阅读全文
posted @ 2019-03-12 19:23 Zhentiw 阅读(512) 评论(0) 推荐(0) 编辑
摘要:We will incorporate npm specific environment variables when executing various npx commands. In our example, we will transpile code to a folder name th 阅读全文
posted @ 2019-03-12 19:09 Zhentiw 阅读(312) 评论(0) 推荐(0) 编辑
摘要:We will use npx to run a package using different versions of Node.js. This can become valuable when testing the various new features that are introduc 阅读全文
posted @ 2019-03-12 19:05 Zhentiw 阅读(193) 评论(0) 推荐(0) 编辑
摘要:We can using gzip and crypto with stream: Also unzip it: 阅读全文
posted @ 2019-03-12 14:49 Zhentiw 阅读(343) 评论(0) 推荐(0) 编辑
摘要:Node.js come alone with many Stream API. Stream is useful when handling large trunck of data. For example, we have a big file to read from file system 阅读全文
posted @ 2019-03-12 14:31 Zhentiw 阅读(296) 评论(0) 推荐(0) 编辑
摘要:For example you have a server.js file, and you want to debug some problems; What you can do is: Then go to chrome broswer: You will find node.js targe 阅读全文
posted @ 2019-03-09 18:16 Zhentiw 阅读(171) 评论(0) 推荐(0) 编辑
摘要:It might be possible for our node server has some downtime, no matter it is because server update or simply some crashs in the code. We want to minizi 阅读全文
posted @ 2019-03-09 17:16 Zhentiw 阅读(374) 评论(0) 推荐(0) 编辑
摘要:Let's see how to do load balancing in Node.js. Before we start with the solution, you can do a test to see the ability concurrent requests your curren 阅读全文
posted @ 2019-03-08 22:51 Zhentiw 阅读(237) 评论(0) 推荐(0) 编辑
摘要:When build server, if we have a API endpoint requires some heavy calculation process, it will block the whole world. In this post, we will see how to 阅读全文
posted @ 2019-03-08 22:13 Zhentiw 阅读(305) 评论(0) 推荐(0) 编辑
摘要:Creating Markdown files from a template is a straightforward process with Node.js and Mustache. You can define a template, load it into your script, t 阅读全文
posted @ 2019-01-31 19:06 Zhentiw 阅读(246) 评论(0) 推荐(0) 编辑

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