再好的烤串也需要有个盒子装
想象一下你有一间木屋烧烤的店面,
红圈圈是店面的一桌客人
客人提出:服务员,XXXX的烤串(例如:面筋要放在一个精制的盘子上,我还要分开出来,我吃面筋,不喜欢串味)


用烤串的思考模式来看待自定义模块设计
https://www.bilibili.com/read/cv22839127(最最粗暴的上菜)
精制的上菜,这个面筋用盘子装起来:

告诉客人,菜来了

babiq写的是什么:

相关代码如下:babiq
function formatApi(api) {
return "http://www.happy study.com/"+api;
}
exports.formatApi=formatApi;
--------------------------------------------------
相关代码如下:1.js
const http=require('http');
const tools=require('./babiq.js');
//(菜单1:面筋)
console.log(tools);
http.createServer((req,res)=>{
res.writeHead(200,{'Content-Type':"text/html;charset='utf-8'"});
res.write("<head><meta charset='UTF-8'></head>");
var api=formatApi('api/plist');
res.write('你好哇~来学习呀');
res.write(api);
res.end();
}).listen(5000);

--------------------------------------------------------
火眼金睛:
const http=require('http');
const tools=require('./babiq.js');
//(菜单1:面筋)
console.log(tools);
http.createServer((req,res)=>{
res.writeHead(200,{'Content-Type':"text/html;charset='utf-8'"});
res.write("<head><meta charset='UTF-8'></head>");
res.write('你好哇~来学习呀');
var api=tools.formatApi('api/我已经发生衔接');
res.write(api);
res.end();
}).listen(5000);

