Skip to content

Instantly share code, notes, and snippets.

@Calvin-Huang
Last active January 16, 2019 10:53
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 Calvin-Huang/d5e934f984f86d99f01e0fd82fcb599a to your computer and use it in GitHub Desktop.
Save Calvin-Huang/d5e934f984f86d99f01e0fd82fcb599a to your computer and use it in GitHub Desktop.
const testExpressModule = require('./test-express-module');
module.exports = (req, res) => {
res.json({ path: '/bar', testExpressModule });
};
const testExpressModule = require('./test-express-module');
module.exports = (req, res) => {
res.json({ path: '/foo' , testExpressModule});
};
const moment = require('moment');
const instance = {
timestamp: moment().utc(),
};
console.log(`The test-express-module initialized at: ${moment().utc()}`);
module.exports = instance;
const express = require('express');
const app = express();
const foo = require('./test-express-foo');
const bar = require('./test-express-bar');
app.get('/', (req, res) => {
console.log(req.query);
res.json({});
});
app.get('/foo', foo);
app.get('/bar', bar);
app.listen(3000, () => {
console.log('test server is running on port 3000');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment