Skip to content

Commit

Permalink
added logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Wu authored and Jack Wu committed Feb 20, 2023
1 parent 1f8e397 commit 88fa2a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ const fs = require('fs');
const path = require("path");
const readline = require("readline");
const express = require("express");
const session = require('express-session')
const MemoryStore = require('memorystore')(session)
const morgan = require('morgan');
const session = require('express-session');
const MemoryStore = require('memorystore')(session);
const { Document } = require("flexsearch");

const app = express();

morgan.token('body', (req, res) => JSON.stringify(req.body));
app.use(morgan(':remote-addr :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent" ":body"', {
stream: fs.createWriteStream('./access.log', {flags: 'a'})
}));
app.use(express.static(path.join(__dirname, '../client/public')));
app.use(express.json());
//app.use(express.urlencoded({extended: false}));
Expand Down

0 comments on commit 88fa2a1

Please sign in to comment.