![](https://img-blog.csdnimg.cn/20190918140158853.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Node
文章平均质量分 50
Node使用总结及其常见的使用场景
ccxCode
这个作者很懒,什么都没留下…
展开
-
nodejs实现登录认证功能--使用session方式
具体详细的代码可以看我的个人github校验登录信息// 命中登录路由function loginRouter(req, res) { const promsie = new Promise((resolve, reject) => { if(req.path === '/api/user/login') { // 拿到password, username const { password, username } = req.body // ..原创 2021-07-03 19:57:50 · 1306 阅读 · 0 评论 -
nodejs实现日志功能
目录结构环境搭建安装nodemonnpm i nodemon cross-env --save-dev// package.json"dev": "cross-env NODE_ENV=dev --inspect=9229 nodemon ./index.js"创建http服务const http = require('http')const server = http.createServer((req, res) => { res.end('hello node')})原创 2021-06-24 22:51:33 · 2427 阅读 · 0 评论 -
path.resolve和_dirname结合使用
在任何模块文件内部,可以使用__dirname变量获取当前模块文件所在目录的完整绝对路径。在应用程序根目录下新建app.js文件,其中代码如下所示。var testModule1=require(’. ./test/testModule.js’);在应用程序根目录下新建一个test子目录,在该目录下新建一个testModule.js文件,其中代码如下所示。console.log(__...原创 2018-10-21 10:22:52 · 3856 阅读 · 0 评论