<file_sep>const ENV = process.argv;
const APP_PORT = process.env.APP_PORT || 3005;

const config = {
    APP_PORT,
    ENV,
};

module.exports = config;<file_sep># lohika-training-nodejs
Nodejs training course

### Run project
- `npm start`

## 1. Homework #1:
- Create the app.js file with the server example (may be copied from the slides) which accepts requests and responds with “Hellow world!” message to all requests.
  >	- server on port APP_PORT which responds with “Hello world!” message to all requests.
  
- Take APP_PORT (for server) from env variables, ENV from cli args and populate config object which will be imported in the app.js from config.js.
	> - APP_PORT env variable
	> - ENV cli arg
	> - config.js with config object which contains APP_PORT, ENV
	
- When server is up – log a message: `Server is listening on port <PORT>. Env is <ENV>.` Use the logger created in a separate file which will use console methods for now
	
	> - log a message `Server is listening on port <PORT>. Env is <ENV>.` Using the imported logger (from separate file)
<file_sep>const http = require('http');
const config = require('./config');
const logger = require('./logger');

const {
    APP_PORT: PORT,
    ENV,
} = config;

http.createServer((req, res) => {
    console.log('New incoming request');
    res.writeHeader(200, { 'Content-Type': 'application/json' });
    res.end(JSON.stringify({ message: 'Hello world!' }));
}).listen(PORT, () => logger.log(`Listening on port ${PORT}... Env is ${ENV}`));
