http = require ‘http’
urlLib = require ‘url’
fs = require ‘fs’
JSON.parse(字符串)
Json.stringify(对象)
urlLib.parse(req.url,true)={
query:
path:
}
#本地www目录
server=http.createServer (req,res)->
url = urlLib.parse req.url
console.log url.path
fs.readFile www+url.path,(err,data)->
if err
tip =
‘’’
404 Not Found
‘’’
res.write tip
else
res.write data
res.end()
server.listen 80