step: context base route
This commit is contained in:
1 parent
84fa3ee3b4
commit
4f8eaca8e1
9 files changed
+51
-12
No files matched your search
@@ -5,6 +5,14 @@ import { fileURLToPath } from 'url';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const app = express();
|
||||
|
||||
// Runtime app configuration, served as window.__APP_CONFIG__.
|
||||
// Must be registered before the static/catch-all routes.
|
||||
const mqttTopicRoot = process.env.MQTT_TOPIC_ROOT || 'staging/outdoor/king-arthur/sword/';
|
||||
app.get('/config.js', (req, res) => {
|
||||
res.type('application/javascript').send(`window.__APP_CONFIG__ = ${JSON.stringify({ mqttTopicRoot })};`);
|
||||
});
|
||||
console.log(`MQTT topic root: ${mqttTopicRoot}`);
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'dist')));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
|
||||
Reference in new issue
Block a user