
Sublime下建立Node編譯系統(tǒng)
做什么的
在Node下建立編譯系統(tǒng)主要的作用是方便開(kāi)發(fā)調(diào)試文件
怎么建立
選擇 "工具" -> "編譯系統(tǒng)" -> '編譯新系統(tǒng)', 輸入如下內(nèi)容:
{
"cmd": ["node", "$file"],
"selector": "source.js"
}Ctrl + S 保存為node.sublime-bulid 即可
怎么使用
建立測(cè)試文件server.js文件內(nèi)容如下:
const http = require('http');
const hostname = 'localhost';
const port = '3000';
const server = http.createServer((req, res) => {
res.writeHead(200, {'content-type': 'text/plain'});
res.end('hello world');
});
server.listen(port, hostname, () => {
console.log(`server is running at http://${hostname}:${port}`);
});按快捷鍵 Ctrl + B 執(zhí)行文件編譯, 輸出如下內(nèi)容則說(shuō)明Sublime下的Node編譯系統(tǒng)建立成功
server is running at http://localhost:3000
按Esc鍵關(guān)閉編譯框
小伙伴們?cè)赟ublime下建立Node編譯系統(tǒng)環(huán)境是不是灰嘗簡(jiǎn)單(^-^), 動(dòng)手試一下吧!






