Last active
February 13, 2019 16:37
-
-
Save bbachi/c8964ba91eacc57d3bf51c16093fa216 to your computer and use it in GitHub Desktop.
How to write production ready Node.js Rest API with Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"), | |
| bodyParser = require("body-parser"), | |
| logger = require('./logger/logger'), | |
| app = express(), | |
| port = 3070; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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