Skip to content

Commit

Permalink
Merge pull request #608 from eik-lib/fastify-5
Browse files Browse the repository at this point in the history
Fastify 5
  • Loading branch information
wkillerud authored Nov 13, 2024
2 parents 9e84f00 + b629f76 commit 63cc9f0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- run: npm install

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18, 20]
exclude:
- os: windows-latest
node-version: 18 # upload tests fail with ECONNRESET for unknown reasons on Node 18 on Windows
node-version: [20, 22]
runs-on: ${{ matrix.os }}

steps:
Expand Down
11 changes: 9 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import jwt from "@fastify/jwt";
import eik from "@eik/core";
import SinkMemory from "@eik/sink-memory";
import SinkFileSystem from "@eik/sink-file-system";
import zlib from "node:zlib";

import config from "./config.js";
import * as utils from "./utils.js";
Expand Down Expand Up @@ -208,7 +209,7 @@ const EikService = class EikService {
);
}

app.register(cors);
await app.register(cors);

// Authentication
app.register(jwt, {
Expand Down Expand Up @@ -242,11 +243,17 @@ const EikService = class EikService {
req.raw[_multipart] = true;
cb();
}
app.addContentTypeParser("multipart", setMultipart);
app.addContentTypeParser("multipart/form-data", setMultipart);

// Compression
await app.register(compression, {
global: config.get("compression.global"),
brotliOptions: {
// The default is 4 (was 11 before @fastify/compress@^7.0.0).
// 5 sees benefits for file sizes above 64Kb, of which we have several.
// https://github.com/fastify/fastify-compress/pull/278#issuecomment-1914778795
[zlib.constants.BROTLI_PARAM_QUALITY]: 5,
},
});

// 404 handling
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
"@eik/sink": "1.2.5",
"@eik/sink-file-system": "1.0.1",
"@eik/sink-memory": "1.1.2",
"@fastify/compress": "6.5.0",
"@fastify/cors": "8.5.0",
"@fastify/jwt": "7.2.4",
"@fastify/compress": "8.0.1",
"@fastify/cors": "10.0.1",
"@fastify/jwt": "9.0.1",
"convict": "6.2.4",
"fastify": "4.28.1",
"fastify": "5.1.0",
"http-errors": "2.0.0",
"js-yaml": "4.1.0",
"pino": "8.21.0"
"pino": "9.5.0"
},
"devDependencies": {
"@eik/eslint-config": "1.0.4",
Expand Down

0 comments on commit 63cc9f0

Please sign in to comment.