Added service worker support, needs work
You must manually enable support, I'm not having it on untill it'll work without issues all of the time :P
This commit is contained in:
parent
26f106c517
commit
c794ae46c7
9 changed files with 126 additions and 14 deletions
9
index.js
9
index.js
|
@ -4,7 +4,15 @@ const express = require('express');
|
|||
const fs = require('fs');
|
||||
const app = express();
|
||||
|
||||
app.use("/getupdates",(req, res) => {
|
||||
const out=fs.statSync(`${__dirname}/webpage`);
|
||||
res.send(out.mtimeMs+"");
|
||||
});
|
||||
let debugging=true;
|
||||
app.use('/', (req, res) => {
|
||||
if(debugging&&req.path.startsWith("/service.js")){
|
||||
res.send("console.log(\"Hi :3\")");
|
||||
}
|
||||
if(fs.existsSync(`${__dirname}/webpage${req.path}`)) {
|
||||
res.sendFile(`./webpage${req.path}`, {root: __dirname});
|
||||
}
|
||||
|
@ -16,6 +24,7 @@ app.use('/', (req, res) => {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
const PORT = process.env.PORT || +process.argv[1] || 8080;
|
||||
app.listen(PORT, () => {});
|
||||
console.log("this ran :P");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue