Ghost/core/server/admin/serviceworker.js
Hannah Wolfe bcf5a1bc34
Switch to Eslint (#9197)
refs #9178

* Add eslint deps, remove old lint deps
* Add eslint config, remove old lint configs
* Config for server and tests are different
* Tweaked rules to suit us
* Fix linting in codebase - lots of indent changes.
* Fix a real broken test
2017-11-01 13:44:54 +00:00

16 lines
512 B
JavaScript

var debug = require('ghost-ignition').debug('admin:serviceworker'),
path = require('path');
// Route: index
// Path: /ghost/sw.js|sw-registration.js
// Method: GET
module.exports = function adminController(req, res) {
debug('serviceworker called');
var sw = path.join(__dirname, '..', '..', 'built', 'assets', 'sw.js'),
swr = path.join(__dirname, '..', '..', 'built', 'assets', 'sw-registration.js'),
fileToSend = req.url === '/sw.js' ? sw : swr;
res.sendFile(fileToSend);
};