How to access laravel env variables in node js?

*爱你&永不变心* 提交于 2019-12-04 11:33:57

check this package for node.js dotenv

You can define path to .env file as

require('dotenv').config({path: '/custom/path/to/laravel/'});

If they’re defined in the .env file then you can’t: it’s a PHP package Laravel uses that reads those values and makes them available in the application.

Instead, set actual environment variables on your server or in your host definition. Then both your Laravel application and any other application will be able to read them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!