Oracle Magazine, May/June 2018
Database Developer OPEN SOURCE known to be one of the best and simplest Lets install morgan with npm ORACLE MAGAZINE MAY JUNE 2018 100 npm install morgan s Next add the following line to services web server js under the line that requires Express line 2 const morgan require morgan Now you can incorporate morgan as a middleware function that all requests will go through with app use Add this line before the app get call that produces the Hello World message Combines logging info from request and response app use morgan combined app get call below this line Note that app use is creating a pipeline of middleware functions that can interact with HTTP requests and responses The middleware functions will execute in the order in which they are included Restart the app and position the terminal so you can see it and Firefox at the same time Each time you reload the page in Firefox you should see a new log entry appear in the terminal By default morgan streams log info to STDOUT which is displayed in the terminal
You must have JavaScript enabled to view digital editions.