Configure your existing Fastify instance with routes that conform to the Routing V1 HTTP API spec.
import fastify from 'fastify'import cors from '@fastify/cors'import { createHelia } from 'helia'import routes from '@helia/routing-v1-http-api-server/routes'const server = fastify({ // fastify options})await server.register(cors, { origin: '*', methods: ['GET', 'OPTIONS'], strictPreflight: false})const helia = await createHelia()// configure Routing V1 HTTP API routesroutes(server, helia)await server.listen({ // fastify listen options})// now make http requests Copy
import fastify from 'fastify'import cors from '@fastify/cors'import { createHelia } from 'helia'import routes from '@helia/routing-v1-http-api-server/routes'const server = fastify({ // fastify options})await server.register(cors, { origin: '*', methods: ['GET', 'OPTIONS'], strictPreflight: false})const helia = await createHelia()// configure Routing V1 HTTP API routesroutes(server, helia)await server.listen({ // fastify listen options})// now make http requests
Configure your existing Fastify instance with routes that conform to the Routing V1 HTTP API spec.
Example