Documentation
Gateway
Deployment
Serverside JS Runtimes
Node.js

Node.js

Node.js is the most common runtime for JavaScript.

If you have Node.js environment, we highly recommend to use Hive Gateway with the CLI as described in the introduction. If you really want to use the runtime in a customized way. You can use the createGatewayRuntime function from @graphql-hive/gateway package.

Hive Gateway CLI

You can follow the introduction page directly to use Hive Gateway CLI. See here

Hive Gateway Runtime (advanced-only)

Use this method only if you know what you are doing. It is recommended to use Hive Gateway CLI for most cases.

import { createServer } from 'http'
import { createGatewayRuntime } from '@graphql-hive/gateway'
 
const serveRuntime = createGatewayRuntime(/* Your configuration */)
const server = createServer(serveRuntime)
server.listen(4000, () => {
  console.log(`Server is running on http://localhost:4000`)
})