Environment Configuration
Noblex uses dotenv
to load environment variables from a .env
file. This lets you manage configuration like database URIs, ports, and secrets without hardcoding them in your codebase.
1. Install dotenv
If you haven't already:
npm install noblex dotenv
To use modern ES module syntax (import
/ export
) in your Node.js project, add this to your package.json
:
{
"type": "module"
}
2. Create environment files
For development, create a file named .env.development
at your project root:
APP_PORT=4000
APP_HOST=http://localhost
DB_NAME=noblex_test_db
DB_HOST=127.0.0.1
DB_PORT=27017
DB_USER=
DB_PASS=