打開VS code,「文件-首選項-用戶代碼片斷-選擇新建全局代碼片斷文件 「node
屬性介紹:prefix 就是你自定義的快捷鍵服務器
body 就是你自定義的代碼片斷ui
description 就是這段代碼的註釋spa
demo : code
{
"Print to console": {
"prefix":
"nodes",
"body": [
"const http = require('http')",
"const server = http.createServer()",
"server.on('request', (req, res) => {",
" console.log('我是node服務器')",
"$1",
"})",
"server.listen(3000, () => {",
" console.log('server running at http://127.0.0.1:3000');",
"})"
],
"description":
"node 服務器"
}
}