Add subdomain conf bones
This commit is contained in:
parent
0c71a988f1
commit
cfcc99b209
12 changed files with 93 additions and 14 deletions
11
app.js
11
app.js
|
@ -5,9 +5,13 @@ var logger = require('morgan');
|
|||
var cookieParser = require('cookie-parser');
|
||||
var bodyParser = require('body-parser');
|
||||
var sassMiddleware = require('node-sass-middleware');
|
||||
var subdomain = require('express-subdomain');
|
||||
|
||||
var index = require('./routes/index');
|
||||
var users = require('./routes/users');
|
||||
var cufs = require('./routes/cufs');
|
||||
var uonetplus = require('./routes/uonetplus');
|
||||
var uonetplusOpiekun = require('./routes/uonetplus-opiekun');
|
||||
var uonetplusUzytkownik = require('./routes/uonetplus-uzytkownik');
|
||||
|
||||
var app = express();
|
||||
|
||||
|
@ -29,8 +33,11 @@ app.use(sassMiddleware({
|
|||
}));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use(subdomain('cufs', cufs));
|
||||
app.use(subdomain('uonetplus', uonetplus));
|
||||
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun));
|
||||
app.use(subdomain('uonetplus-uzytkownik', uonetplusUzytkownik));
|
||||
app.use('/', index);
|
||||
app.use('/users', users);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
|
|
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -669,6 +669,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"express-subdomain": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/express-subdomain/-/express-subdomain-1.0.5.tgz",
|
||||
"integrity": "sha1-mQ75eUC39MKCPZWTZIt5voWKY4s="
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"cookie-parser": "~1.4.3",
|
||||
"debug": "~3.1.0",
|
||||
"express": "~4.16.2",
|
||||
"express-subdomain": "^1.0.5",
|
||||
"jade": "~1.11.0",
|
||||
"morgan": "~1.9.0",
|
||||
"node-sass-middleware": "0.11.0",
|
||||
|
|
18
routes/cufs.js
Normal file
18
routes/cufs.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.get("/", function(req, res) {
|
||||
res.redirect("/Default/Account/LogOn");
|
||||
});
|
||||
|
||||
// GET login page
|
||||
router.get("/Default/Account/LogOn", function(req, res) {
|
||||
res.render("login-form", { title: "login (Default)" });
|
||||
});
|
||||
|
||||
// POST login
|
||||
router.post("/Default/Account/LogOn", function(req, res) {
|
||||
res.json({"message": "Not implemented yet"});
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -2,8 +2,8 @@ var express = require('express');
|
|||
var router = express.Router();
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
res.render('index', { title: 'fake-log' });
|
||||
router.get('/', function(req, res) {
|
||||
res.render('index', { title: 'fake-log', domain: req.get('host') });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
11
routes/uonetplus-opiekun.js
Normal file
11
routes/uonetplus-opiekun.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.get("/", function(req, res) {
|
||||
res.json({
|
||||
"name" : "uonetplus-opiekun",
|
||||
"message": "Not implemented yet"
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
11
routes/uonetplus-uzytkownik.js
Normal file
11
routes/uonetplus-uzytkownik.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.get("/", function(req, res) {
|
||||
res.json({
|
||||
"name" : "uonetplus-uzytkownik",
|
||||
"message": "Not implemented yet"
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
11
routes/uonetplus.js
Normal file
11
routes/uonetplus.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.get("/", function(req, res) {
|
||||
res.json({
|
||||
"name" : "uonetplus",
|
||||
"message": "Not implemented yet"
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -1,9 +0,0 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
/* GET users listing. */
|
||||
router.get('/', function(req, res, next) {
|
||||
res.send('respond with a resource');
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -2,4 +2,13 @@ extends layout
|
|||
|
||||
block content
|
||||
h1= title
|
||||
p Welcome to #{title}
|
||||
p Welcome to #{title}!
|
||||
ul
|
||||
li
|
||||
a(href="http://cufs.fakelog.localhost:3000") cufs
|
||||
li
|
||||
a(href="http://uonetplus.fakelog.localhost:3000") uonetplus
|
||||
li
|
||||
a(href="http://uonetplus-opiekun.fakelog.localhost:3000") uonetplus-opiekun
|
||||
li
|
||||
a(href="http://uonetplus-uzytkownik.fakelog.localhost:3000") uonetplus-uzytkownik
|
||||
|
|
|
@ -5,3 +5,5 @@ html
|
|||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
body
|
||||
block content
|
||||
footer
|
||||
a(href="https://github.com/wulkanowy/fake-log") Github
|
13
views/login-form.jade
Normal file
13
views/login-form.jade
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
form(method="post")
|
||||
h1= title
|
||||
|
||||
label(for="LoginName") email
|
||||
input(name="LoginName" id="LoginName" type="text")
|
||||
|
||||
label(for="Password") password
|
||||
input(name="Password" id="Password" type="password")
|
||||
|
||||
input(type="submit")
|
Loading…
Reference in a new issue