This commit is contained in:
Benjamin Palko 2024-12-02 09:43:56 -05:00
commit f8a16a9fce
8 changed files with 95 additions and 0 deletions

8
src/index.ts Normal file
View file

@ -0,0 +1,8 @@
import { createYoga } from "graphql-yoga";
import { schema } from "./schema";
const yoga = createYoga({ schema });
const server = Bun.serve({ fetch: yoga.fetch });
console.log(`Server is running on: ${server.url}${yoga.graphqlEndpoint}`);

13
src/schema.ts Normal file
View file

@ -0,0 +1,13 @@
import SchemaBuilder from "@pothos/core";
const builder = new SchemaBuilder({});
builder.queryType({
fields: (t) => ({
hello: t.string({
resolve: () => "world",
}),
}),
});
export const schema = builder.toSchema();