feat: add route helper to handler context
This commit is contained in:
parent
9613188a1c
commit
28a441d98a
2 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
|
@ -88,6 +88,8 @@ function bootstrapContext(db, structureId, routeId, initContext) {
|
||||||
// todo wrap template in data-bliss-edit-template thing since ws can't take us to the editor on a component basis?? maybe...
|
// todo wrap template in data-bliss-edit-template thing since ws can't take us to the editor on a component basis?? maybe...
|
||||||
// for now just designing with component approach
|
// for now just designing with component approach
|
||||||
const eta = model.getTemplater(structureId);
|
const eta = model.getTemplater(structureId);
|
||||||
|
const structure = model.getStructure(db, structureId)
|
||||||
|
const __urlPrefix = structure.route_prefix;
|
||||||
|
|
||||||
const libs = { eta, db: getDb, push: webPush, files: { saveFile: (...args) => saveFile(structureId, ...args) } };
|
const libs = { eta, db: getDb, push: webPush, files: { saveFile: (...args) => saveFile(structureId, ...args) } };
|
||||||
|
|
||||||
|
|
@ -120,7 +122,10 @@ function bootstrapContext(db, structureId, routeId, initContext) {
|
||||||
vapidPublicKey: vapidPublicKey,
|
vapidPublicKey: vapidPublicKey,
|
||||||
fetch: fetch,
|
fetch: fetch,
|
||||||
clearTimeout: clearTimeout,
|
clearTimeout: clearTimeout,
|
||||||
setTimeout: setTimeout
|
setTimeout: setTimeout,
|
||||||
|
route: function (url) {
|
||||||
|
return __urlPrefix ? path.join(__urlPrefix, url) : url;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
for (let appDb of dbs) {
|
for (let appDb of dbs) {
|
||||||
let dbInstance = model.getDbInstance(appDb.id);
|
let dbInstance = model.getDbInstance(appDb.id);
|
||||||
|
|
|
||||||
BIN
out.mp3
Normal file
BIN
out.mp3
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue