Hello! Just wanted to say thank you very much for this awesome package. I've been able to get up and running really quickly, and it is so far very pleasing to use!
I am however, running into a little issue. I'm probably doing something dumb, but I figured I'd pose the question here to find out a bit more.
const PORT = 5759;
const subdomain = require('express-subdomain');
const express = require('express');
const app = express();
/*
* SUBDOMAIN ROUTER `create.example.com/{whatever}`
*/
const router = express.Router();
const creatorRoutes = [
'',
'home',
'profile*'
];
creatorRoutes.forEach(route => {
router.get(`/${route}`, (req, res) => {
res.sendFile(`${__dirname}/creator-index.html`);
});
});
router.get('/creator-login.html', (req, res) => {
res.sendFile(`${__dirname}/creator-login.html`);
});
app.use(subdomain('create', router));
/*
* MAIN ROUTES `example.com/{whatever}`
*/
const mainRoutes = [
'',
'search'
];
mainRoutes.forEach(route => {
app.get(`/${route}`, (req, res) => {
res.sendFile(`${__dirname}/main-index.html`);
});
});
app.get('/main-login.html', (req, res) => {
res.sendFile(`${__dirname}/main-login.html`);
});
app.listen(PORT);
Now this works beautifully when you hit:
http://create.example.com/home
http://create.example.com/profile
and so on, those work great. They serve up creator-index.html and everything is hunky-dory. Vice versa for the search and "" routes for the main app router.
However http://create.example.com/search redirects to the base, non-subdomained URL, even though it is not definedin my subdomain router. Is there a reason why it falls back to the app routes, rather than seeing, "Oh, I have nothing in the subdomain router that matches that, i should return 404"
Thank you very much for your time and I appreciate any insight you might have!
Hello! Just wanted to say thank you very much for this awesome package. I've been able to get up and running really quickly, and it is so far very pleasing to use!
I am however, running into a little issue. I'm probably doing something dumb, but I figured I'd pose the question here to find out a bit more.
Now this works beautifully when you hit:
http://create.example.com/homehttp://create.example.com/profileand so on, those work great. They serve up
creator-index.htmland everything is hunky-dory. Vice versa for thesearchand""routes for the main app router.However
http://create.example.com/searchredirects to the base, non-subdomained URL, even though it is not definedin my subdomain router. Is there a reason why it falls back to the app routes, rather than seeing, "Oh, I have nothing in the subdomain router that matches that, i should return 404"Thank you very much for your time and I appreciate any insight you might have!