add offline support
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import express from 'express';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { offlineManifest } from './src/services/offline-manifest.js';
|
||||
import { config, ensureRuntimeDirectories } from './src/config.js';
|
||||
import { openDatabase } from './src/database.js';
|
||||
import { createApiRouter } from './src/routes/api.js';
|
||||
@@ -18,6 +19,10 @@ app.use(express.json({
|
||||
type: ['application/json', 'application/*+json', 'text/json']
|
||||
}));
|
||||
app.use(express.urlencoded({ extended: true, limit: '2mb' }));
|
||||
app.get('/api/offline-manifest', (req, res) => {
|
||||
res.setHeader('Cache-Control', 'no-store');
|
||||
res.json(offlineManifest(publicDirectory));
|
||||
});
|
||||
app.use('/api', createApiRouter(db));
|
||||
app.use(express.static(publicDirectory, {
|
||||
extensions: ['html'],
|
||||
|
||||
Reference in New Issue
Block a user