diff --git "a/\345\200\252\345\273\272\350\261\252/20200306/css/style.css" "b/\345\200\252\345\273\272\350\261\252/20200306/css/style.css" new file mode 100644 index 0000000000000000000000000000000000000000..2ec5efecc60db3b2d41508256d3a542367dd9de5 --- /dev/null +++ "b/\345\200\252\345\273\272\350\261\252/20200306/css/style.css" @@ -0,0 +1,3 @@ +body{ + background-color: rgb(99, 160, 168); +} \ No newline at end of file diff --git "a/\345\200\252\345\273\272\350\261\252/20200306/image/img1.png" "b/\345\200\252\345\273\272\350\261\252/20200306/image/img1.png" new file mode 100644 index 0000000000000000000000000000000000000000..5b55b125a984333b44c927c0a2cc6ba4eb80d29a Binary files /dev/null and "b/\345\200\252\345\273\272\350\261\252/20200306/image/img1.png" differ diff --git "a/\345\200\252\345\273\272\350\261\252/20200306/js/homework.js" "b/\345\200\252\345\273\272\350\261\252/20200306/js/homework.js" new file mode 100644 index 0000000000000000000000000000000000000000..7d79c6d5d1ebc9f85a8b02da18581dd3bd99a355 --- /dev/null +++ "b/\345\200\252\345\273\272\350\261\252/20200306/js/homework.js" @@ -0,0 +1,33 @@ +/** + * 作业布置 + * + * 优化 http 处理不同静态文件 css js image,放在不同的目录 css 放于 css 目录下 + * + * js放于 js 目录下,image 放于 image 下 + * + * + * mvc 是一种思想,一种设计模式 + * + * + * express koa koa2 + * + * + */ + +let http=require('http'); +let fs=require('fs'); + +let sever=http.createServer(); + +sever.on('request',(req,res)=>{ + let url=req.url; + console.log(url); + if (req.url=='/image') { + res.end(fs.readFileSync('../image/img1.png')) + } + if(req.url=='/css'){ + res.end(fs.readFileSync('../css/style.css')) + } + res.end() +}) +sever.listen(8080)