![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
nodejs
文章平均质量分 52
七彩冰淇淋与藕汤
这个作者很懒,什么都没留下…
展开
-
Nodejs搭建真正与数据库交互的服务器
1.下载MySQL、熟悉最基本的命令 查询命令:select * from blog、select * from blog where id=1 插入命令:INSERT INTO blog (title,content,author,createAt) VALUES ('标题2','内容2','是RYN',0000567890000) 更新命令:update blog set title='标题1',content='内容1' where id=1 删除命令:delete from blog whe原创 2022-03-27 10:50:10 · 1151 阅读 · 0 评论 -
node.js搭建简单的博客服务器(无数据库)
1.环境搭建 在空文件夹下的端口执行:npm init -y,会生成package.json文件 创建文件夹bin,并在文件夹下创建www.js文件,在此文件里创建服务器 const http=require('http') const serverHandler=require('../app.js') const POST=5000 const server=http.createServer(serverHandler) server.listen(POST,()=>{ cons原创 2022-03-26 10:12:32 · 1597 阅读 · 0 评论 -
Node.js创建服务器
1.创建一个服务器并处理get和post请求 引入http模块、 创建服务器(createServer)、里面的传回调参数,回调 参数有请求和响应两个参数。可以获取请求中的内容(req.method请求方法,req.url请求url,req.on可以接收数据)以及设置响应内容(res.end向客户端发送数据)。 const http =require('http') const querystring=require('querystring') const server=http.createSe原创 2022-03-26 09:35:54 · 469 阅读 · 0 评论