Skip to content

Instantly share code, notes, and snippets.

@bbachi
Last active February 13, 2019 16:37
Show Gist options
  • Select an option

  • Save bbachi/c8964ba91eacc57d3bf51c16093fa216 to your computer and use it in GitHub Desktop.

Select an option

Save bbachi/c8964ba91eacc57d3bf51c16093fa216 to your computer and use it in GitHub Desktop.
How to write production ready Node.js Rest API with Javascript
var express = require("express"),
bodyParser = require("body-parser"),
logger = require('./logger/logger'),
app = express(),
port = 3070;
var Logger = function() {};
Logger.prototype.info = function(logText) {
console.log(new Date()+'info:::::'+logText);
};
Logger.prototype.debug = function(logText) {
console.log(new Date()+'debug:::::'+logText);
};
Logger.prototype.error = function(logText) {
console.log(new Date()+'error:::::'+logText);
};
module.exports = new Logger();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment