Created
June 24, 2019 10:51
-
-
Save dimlucas/dce92b0249357bae3142b15b17205122 to your computer and use it in GitHub Desktop.
This file contains 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
// File: A.js | |
console.log("In A.js"); | |
class A { | |
construtor() { | |
//some logic | |
} | |
} | |
module.exports = A; | |
// Alternatively, with ES6 this would be 'export default A' | |
/*-------------------*/ | |
//File B.js | |
console.log("In B.js"); | |
class B { | |
constructor() { | |
//some logic | |
} | |
} | |
module.exports = B; | |
// Alternatively, with ES6 this would be 'export default B' | |
/*-------------------*/ | |
//File C.js | |
console.log("In C.js"); | |
class C { | |
} | |
module.exports = C; | |
// Alternatively, with ES6 this would be 'export default C' | |
/*-------------------*/ | |
//File index.js | |
const express = require("express"); | |
const A = require("A"); //or import A from 'A'; | |
const B = require("B"); //or import B from 'B'; | |
const routes = require("./routes"); | |
//Notice that we don't import anything from C.js | |
const app = express(); | |
app.use(routes); | |
app.listen(3000, () => console.log("Server running on port 3000"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment