Node Module

Node.js

Morgan

# Write logs to a file
 var accessLogStream = fs.createWriteStream(path.join(__dirname, 'access.log'), {flags: 'a'});
 
# Token
morgan.token('date', function(req, res, tz){
     return moment().format("YYYYMMDD HH:mm:ss");
});

# Sample
app.use(morgan('combined'))
app.use(morgan(":remote-addr, :date, :url, :referrer",  { stream: accessLogStream })));

Node.js 설치하기

1. CURL 설치
$ sudo apt-get install build-essential

2. PPA 추가
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

3. NodeJS 설치
$ sudo apt-get install -y nodejs

4. build-essential 설치
$ sudo apt-get install build-essential
 

Subscribe to Keun's Story newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox. It's free!
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!