Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ How the app runs on Vercel:
**Images and assets.**
- **Artwork:** each image is sized to fit its card (`srcset`/`sizes`), lazy-loaded as you scroll, and fades in over its own palette colour. Only the first row loads eagerly.
- **TIDAL player:** loads only when a playlist is opened, and is removed when it closes.
- **CSS, JS and fonts:** served from URLs that include a hash of their contents, so browsers cache them for a year and a deploy updates them all at once. No build step is needed. The Outfit font is self-hosted.
- **CSS, JS and fonts:** served from URLs that include a hash of their contents, so browsers cache them for a year and a deploy updates them all at once. No build step is needed. The DM Sans font is self-hosted, and icons are inlined Lucide SVGs, so no font or icon service is contacted.

## Errors: handling and reporting

Expand Down Expand Up @@ -125,4 +125,4 @@ test/ tests

## Licence

MIT. The Outfit font is licensed under the SIL Open Font License (`public/fonts/OFL.txt`).
MIT. The DM Sans font is licensed under the SIL Open Font License (`public/fonts/OFL.txt`). Icons are from [Lucide](https://lucide.dev) (ISC licence).
10 changes: 8 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
// Entry point. On Vercel this file is the function: it exports the Express app
// and Vercel handles requests. Anywhere else (`npm run dev`, `npm start`) it
// listens on PORT as a normal server.
//
// Vercel only recognises an Express project if this file itself imports and
// creates Express, which is why the app is made here rather than in src/.
import express from 'express';
import { ConfigError } from './src/errors.js';
import { createSite, serve } from './src/site.js';

const app = express();

let site;
try {
site = await createSite();
site = await createSite({ app });
} catch (error) {
// A readable message instead of a stack trace; on Vercel, rethrow so the deploy's logs show it.
if (!(error instanceof ConfigError) || process.env.VERCEL) throw error;
Expand All @@ -16,4 +22,4 @@ try {

if (!site.config.onVercel) serve(site);

export default site.app;
export default app;
Loading
Loading