Skip to content

Instantly share code, notes, and snippets.

@boyzhujian
Created February 6, 2018 08:08
Show Gist options
  • Select an option

  • Save boyzhujian/37a540894a3613ef66d5c0fe327b5c3d to your computer and use it in GitHub Desktop.

Select an option

Save boyzhujian/37a540894a3613ef66d5c0fe327b5c3d to your computer and use it in GitHub Desktop.
###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