-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: add express server for efficient loading
- Loading branch information
1 parent
ec1a8f3
commit 62397de
Showing
4 changed files
with
1,042 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const express = require('express'); | ||
const compression = require('compression'); | ||
const path = require('path'); | ||
|
||
const app = express(); | ||
|
||
// Enable compression for all responses | ||
app.use(compression({ | ||
level: 9, | ||
threshold: 0 | ||
})); | ||
|
||
app.use(express.static(path.join(__dirname), { | ||
maxAge: '1h' | ||
})); | ||
|
||
const PORT = 3000; | ||
app.listen(PORT, '127.0.0.1', () => { | ||
console.log(`Music Blocks running at http://127.0.0.1:${PORT}/`); | ||
console.log('Compression enabled'); | ||
}); |
Oops, something went wrong.