Last active
January 16, 2019 10:53
-
-
Save Calvin-Huang/d5e934f984f86d99f01e0fd82fcb599a 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
const testExpressModule = require('./test-express-module'); | |
module.exports = (req, res) => { | |
res.json({ path: '/bar', testExpressModule }); | |
}; |
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
const testExpressModule = require('./test-express-module'); | |
module.exports = (req, res) => { | |
res.json({ path: '/foo' , testExpressModule}); | |
}; |
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
const moment = require('moment'); | |
const instance = { | |
timestamp: moment().utc(), | |
}; | |
console.log(`The test-express-module initialized at: ${moment().utc()}`); | |
module.exports = instance; |
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
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