Blogger Information
Blog 77
fans 0
comment 2
visits 55636
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
node-todo小项目===待续
南瓜又个梦
Original
411 people have browsed it

初始化项目

  1. yarn inin -y
  2. //创建package.json文件
  1. const homedir =require('os').homedir()
  2. //这种是获取home路径
  3. //但是一般是要获取home变量,因为可能有人配置了home目录
  4. const USER_HOME = process.env.HOME || process.env.USERPROFILE
  5. ==============
  6. const homedir =require('os').homedir()
  7. const home =process.env.HOME ||homedir

node.js是需要拼路径的,因为要解决mac和linux和windows路劲里的\和/

  1. const p=require('path')
  2. //拼路径的函数
  3. const dbPath=p.join(home,'.todo')
  4. //将home代表的路径和todo这个文件名拼起来
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post