Skip to content

Commit 676ce08

Browse files
committed
fix: Upgrade use of micro
1 parent 383aa91 commit 676ce08

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

src/__tests__/parser-compat.tests.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-env jest */
1+
import { Server } from "node:http";
22
import micro from "micro";
33

44
import createHandler from "../";
@@ -10,7 +10,9 @@ describe("Same query should give same output for different parsers", () => {
1010
let response: { data: { [key in ParserKey]: unknown }; errors: any[] };
1111
let keys: ParserKey[] = [];
1212
beforeAll(async () => {
13-
const service = micro(await createHandler({ version: "version" }));
13+
const service = new Server(
14+
micro(await createHandler({ version: "version" })),
15+
);
1416

1517
const { url, close } = await listen(service);
1618

src/__tests__/utils.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { Server } from "node:http";
2-
/* eslint-env jest */
1+
import { Server } from "node:http";
32
import micro from "micro";
43

54
import createHandler from "../";
@@ -27,10 +26,12 @@ export function testGraphqlApi(
2726
) {
2827
const query = String.raw(strings, ...args);
2928
test(query, async () => {
30-
const service = micro(
31-
await createHandler({
32-
version: "test",
33-
}),
29+
const service = new Server(
30+
micro(
31+
await createHandler({
32+
version: "test",
33+
}),
34+
),
3435
);
3536

3637
const { url, close } = await listen(service);

src/cli.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { Server } from "node:http";
12
import { command, number, option, optional, run, string } from "cmd-ts";
2-
import micro, { type RequestHandler } from "micro";
3+
import serve, { type RequestHandler } from "micro";
34
import type { Options } from "./index";
45

56
export function cli({
@@ -45,14 +46,16 @@ export function cli({
4546
}),
4647
},
4748
handler: async (args) => {
48-
const server = micro(
49-
await createHandler({
50-
version,
51-
sentryDsn: args.sentryDsn,
52-
}),
49+
const server = new Server(
50+
serve(
51+
await createHandler({
52+
version,
53+
sentryDsn: args.sentryDsn,
54+
}),
55+
),
5356
);
5457

55-
console.log(`Starting graphql-rss-parser v${version}`);
58+
console.log("Starting graphql-rss-parser v$version");
5659
server.listen(args.port);
5760
},
5861
});

0 commit comments

Comments
 (0)