随笔分类 - 前端歌谣-node
前端歌谣-node
摘要:第一步安装 第二步建立文件夹 第三部 src放源代码 第四步 输入代码 执行
阅读全文
摘要:const fs = require('fs'); const path = require('path'); console.log(__dirname); console.log(path.join(__dirname, './demo01.js')); fs.readFile(path.joi
阅读全文
摘要://导入path模块 const path = require('path'); //路径拼接 const finaPath = path.join('public', 'uploads', 'avater'); console.log(finaPath);
阅读全文
摘要:const fs = require('fs'); fs.writeFile('./demo.txt', '即将要写入的内容', err => { if (err != null) { console.log(err); return; } console.log('文件内容写入成功'); })
阅读全文
摘要://通过模块对模块进行引入 const fs = require('fs'); //读取文件 fs.readFile('./demo01.js', 'utf8', (err, doc) => { console.log(err); console.log(doc); })
阅读全文
摘要:demo04.js const greeting = _name => `hello ${_name}`; module.exports.greeting = greeting; demo05.js const a = require('./demo04.js'); console.log(a);
阅读全文
摘要:demo02.js const add = (n1, n2) => n1 + n2 exports.add = add; demo03.js const a = require('./demo02.js'); console.log(a);
阅读全文
摘要:var first = 'hello nodejs'; console.log(first); function fn() { console.log("fn函数被调用了"); } fn(); for (var i = 0; i < 5; i++) { console.log(i); } if (t
阅读全文
摘要:npm安装jQuery并引入 app.js const http = require('http'); const url = require('url') const querystring = require('querystring') const fs = require('fs') let
阅读全文
摘要:const http = require('http'); const url = require('url') const querystring = require('querystring') let user={ admin:123456 } http.createServer((req,r
阅读全文
摘要:form.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title
阅读全文