Skip to content

Instantly share code, notes, and snippets.

@dimlucas
Created June 24, 2019 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimlucas/dce92b0249357bae3142b15b17205122 to your computer and use it in GitHub Desktop.
Save dimlucas/dce92b0249357bae3142b15b17205122 to your computer and use it in GitHub Desktop.
// 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