express: log to a file, rather than what docker might lose
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
efd9572e32
commit
65cd5b2f1e
1 changed files with 4 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const morgan = require('morgan');
|
||||
const bodyParser = require('body-parser');
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
|
@ -25,8 +26,10 @@ const db = new sqlite3.Database('db/results.db', (err) => {
|
|||
}
|
||||
});
|
||||
|
||||
var accessLogStream = fs.createWriteStream(path.join(__dirname, 'log', 'access.log'), { flags: 'a' })
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(morgan('combined'));
|
||||
app.use(morgan('combined', { stream: accessLogStream }));
|
||||
|
||||
var animals;
|
||||
// check and load animals into redis
|
||||
|
|
Loading…
Reference in a new issue