Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 748 Bytes

README.md

File metadata and controls

44 lines (33 loc) · 748 Bytes

edgeql-on-node-example

EdgeQL works on Node out of box.

JavaScript

import { NodeEdgeQL } from 'edgeql/node'

const app = new NodeEdgeQL()

app.handle(`
type Query {
  hello: String
}
`, (ctx) => {
  return  `hello from EdgeQL on ${ctx.runtime.runtime}`
})

app.listen({port: 4000}, ({address, family, port}) => {
  console.log(address, family, port)
})

TypeScript

import type { Context } from 'edgeql'
import { NodeEdgeQL } from 'edgeql/node'

const app = new NodeEdgeQL()

app.handle(`
type Query {
  hello: String
}
`, (ctx: Context) => {
  return  `hello from EdgeQL on ${ctx.runtime.runtime}`
})

app.listen({port: 4000}, ({address, family, port}) => {
  console.log(address, family, port)
})