-
對的查看全部
-
微型服務器??
let http = require('http')
let fs = require(‘fs’)
http.createServer(req,res)=>{
? ?console.log(req.url);? ?//監聽請求的路徑
? ?fs.readFile(`./${req.url}`,(err,data)=>{
? if(err){
? ? ? res.writeHeader(404)
? ? ? res.end('404 not found')
? ?}else{
? ?res.end(data)?
? ?}
})
}).listen(8888)
查看全部 -
Node中的數據交互:
1、GET:數據放在url里面進行傳輸,容量<32k,只能傳比較小的內容。
2、POST
3、PUT
4、DELETE
查看全部 -
重點:HTTP模塊
服務器對象:http.createServer()
查看全部 -
Node三大模塊:自定義模塊
定義:require自己封裝的模塊;
exports
module:批量導出
require:如果有路徑,就去路徑里面找;如果沒有路徑,就去node_modules里面找。如果沒有路徑也沒有node_modules,再去node的安裝目錄里面找。
查看全部 -
POST 總結
查看全部 -
GET 總結
查看全部 -
基本操作命令
查看全部 -
重點:http模塊
let http = require('http')
http.createServer((request,response)=>{
? ?console.log('創建服務器')
}).listen(8080)? ? ? ? //監聽8080端口
查看全部 -
module.export=function(){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
可以導出對象、方法、類
查看全部 -
Node三大模塊:系統模塊
定義:需要引用,但不需要下載(安裝node時已經內置好)。
path:用于處理文件路徑和目錄路徑的實用工具。
fs:用于文件讀寫操作。
查看全部 -
require
如果有路徑就去路徑中找
沒有就去node_module中找
再去node的安裝目錄里找
查看全部 -
畫圖工具:pointofix查看全部
-
好很好,聽了課我真興奮。查看全部
舉報