mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
feat: support canonical puter.js url in dev
This commit is contained in:
parent
fdea7907be
commit
fd41ae217c
@ -76,6 +76,13 @@ class SelfHostedModule extends AdvancedBase {
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const { ServeSingleFileService } = require('./services/ServeSingeFileService');
|
||||
services.registerService('__serve-puterjs-new', ServeSingleFileService, {
|
||||
path: path_.resolve(__dirname,
|
||||
'../../../src/puter-js/dist/puter.dev.js'),
|
||||
route: '/puter.js/v2',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
19
src/backend/src/services/ServeSingeFileService.js
Normal file
19
src/backend/src/services/ServeSingeFileService.js
Normal file
@ -0,0 +1,19 @@
|
||||
const BaseService = require("./BaseService");
|
||||
|
||||
class ServeSingleFileService extends BaseService {
|
||||
async _init (args) {
|
||||
this.route = args.route;
|
||||
this.path = args.path;
|
||||
}
|
||||
async ['__on_install.routes'] () {
|
||||
const { app } = this.services.get('web-server');
|
||||
|
||||
app.get(this.route, (req, res) => {
|
||||
return res.sendFile(this.path);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ServeSingleFileService,
|
||||
};
|
Loading…
Reference in New Issue
Block a user