Created
February 6, 2018 08:08
-
-
Save boyzhujian/37a540894a3613ef66d5c0fe327b5c3d to your computer and use it in GitHub Desktop.
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
| ###test.js | |
| var express = require('express'); | |
| var router = express.Router(); | |
| router.get('/test', function (req, res) { | |
| res.json(200, {'test': 'it works!'}); | |
| }); | |
| module.exports = router; | |
| ###app.js | |
| var test = require("./routes/test.js"); | |
| var other = require("./routes/other.js"); | |
| ... | |
| //all your code for creating app | |
| ... | |
| app.use('/test', test); | |
| app.use('/other', other); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment