[Node.js] Hanlde process.env with dotenv

import * as dotenv from "dotenv";

const result = dotenv.config();

if (result.error) {
  console.log('Error loading environment variables, aborting.')
  process.exit(1)
}

console.log(process.env.PORT)

 

posted @ 2023-04-26 15:35  Zhentiw  阅读(13)  评论(0编辑  收藏  举报