Skip to content

Instantly share code, notes, and snippets.

@trahloff
Last active January 12, 2017 17:24
Show Gist options
  • Save trahloff/130972389182a0959d17fe14494c37dd to your computer and use it in GitHub Desktop.
Save trahloff/130972389182a0959d17fe14494c37dd to your computer and use it in GitHub Desktop.
// app.js
const express = require('express');
const app = express();
let tmp = new (require('./default'))("hi");
app.use('/', tmp.getRouter());
const http = require('http');
var server = http.createServer(app).listen(7777);
// route.js
var express = require('express');
var whatever;
function routerService(arg1) {
whatev = arg1;
};
routerService.prototype.getRouter = function() {
'use strict';
var api = express.Router();
console.log(whatev);
api.get("/whatev", function(req, res) {
res.send("whatev");
});
return api;
};
module.exports = routerService;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment