# Step 7

Let's create a config file to hold all of our application configurations.&#x20;

```bash
$ npm i -S dotenv
```

src/config/index.js

```javascript
require('dotenv').config();

const env = process.env;

const config = {
	PORT: env.PORT || 5000,
	SECRET: env.SECRET || 'my-secret',
	EXPIRES_IN: env.EXPIRES_IN || '7 days',
	NODE_ENV: env.NODE_ENV || 'development'
};

module.exports = config;
```

The secret and expires variables will be used in the next step. Now, we can replace our PORT variable with our config.

src/index.js

```javascript
const express = require('express');
const { PORT } = require('./config');
const books = require('./routes/books');

const app = express();

app.use(express.json());
...
```
