process.cwd()是 Node.js 中的一个内置方法,表示:当前 Node.js 进程的工作目录(current working directory)
console.log(process.cwd());
如果你在 /Users/merrick/project 目录里运行:
node server.js
你会看到输出:
/Users/merrick/project
process.envall the environment variables from the .env file, making them available to the application on process.env