Skip to content

Commit

Permalink
Add _addAllRoutes to Server
Browse files Browse the repository at this point in the history
  • Loading branch information
martindale committed Oct 29, 2024
1 parent c0db175 commit 5d0c591
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions types/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class FabricHTTPServer extends Service {
components: {},
middlewares: {},
redirects: {},
routes: [],
services: {
audio: {
address: '/devices/audio'
Expand Down Expand Up @@ -347,6 +348,14 @@ class FabricHTTPServer extends Service {
console.warn('[FABRIC:EDGE]', (new Date().toISOString()), content);
}

_addAllRoutes () {
for (let i = 0; i < this.settings.routes.length; i++) {
this._addRoute(this.settings.routes[i]);
}

return this;
}

_registerMethod (name, method) {
this.methods[name] = method.bind(this);
}
Expand Down Expand Up @@ -862,6 +871,8 @@ class FabricHTTPServer extends Service {
// NOTE: see `this.express.use(express.static('assets'));`
this.express.get('/', this._handleIndexRequest.bind(this));

this._addAllRoutes();

// handle custom routes.
// TODO: abolish this garbage in favor of resources.
for (let i = 0; i < this.customRoutes.length; i++) {
Expand Down

0 comments on commit 5d0c591

Please sign in to comment.