File size: 519 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import path from 'path';
import express from 'express';
import manifest from './manifest';

export default () => {
	const app = express();

	// manifest is part of PWA spec, and needs to be dynamic so we can inject l10n, branchName and other context
	app.get( '/calypso/manifest.json', manifest );

	// service-worker needs to be served from root to avoid scope issues
	app.use(
		'/service-worker.js',
		express.static( path.resolve( __dirname, '..', '..', '..', 'public', 'service-worker.js' ) )
	);

	return app;
};