摘要: 我们在本地创建服务器之后需要写不同的后缀名来访问同一个站点的不同页面,如果不实现路由功能。则每次访问localhost:3000 不论后面写什么 比如localhost:3000/index、localhost:3000/detail...最终都会访问同一个地址;而用url路由则可以实现访问不同的页 阅读全文
posted @ 2017-04-02 22:34 大桥默默学 阅读(852) 评论(0) 推荐(0) 编辑
摘要: 'use strict'; //加载http模块; const http = require('http'); //创建一个http服务; const server = http.createServer((req, res) => { res.writeHead(200, { "content-t 阅读全文
posted @ 2017-04-02 14:15 大桥默默学 阅读(215) 评论(0) 推荐(0) 编辑