Last active
January 12, 2017 17:24
-
-
Save trahloff/130972389182a0959d17fe14494c37dd 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
// 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