Create file if it does not exist, then write logs to it
<p>Trying to set up an environment that:</p>

<p><code>server.js</code>:
When the server is created, it will check if the a series of files exist: [api.log, error.log, access.log], if they do not yet exist, it will create them.</p>

<p><code>routes/api.js</code>: 
I can use the file created at start up to, on api errors, log the error.</p>

<p>A lot of the advice revolves around <a href="https://nodejs.org/api/fs.html#fs_fs_exists_path_callback" rel="nofollow">fs.exists()</a> which is now deprecated. </p>

<p>I am struggling to piece together the order of events, shall <code>server.js</code> check for files, act accordingly, then open a stream? Or must <code>routes/api.js</code> open the stream and write to it on every error?</p>

<p>I am using Node v5.0.0</p>