import type { CreateServerOptions, Server } from './createServerHelpers.js'; /** * Creates a server for api functions: * * ```js * import { createServer } from '@cedarjs/api-server' * * import { logger } from 'src/lib/logger' * async function main() { * const server = await createServer({ * logger, * apiRootPath: 'api' * configureServer: (server) => { * // Runs before the api functions and GraphQL plugins are * // registered, i.e. before any routes exist. This is the right * // place for plugins with a "global" mode that hooks `onRoute` * // (e.g. `@fastify/compress`), since those only affect routes * // registered *after* the plugin itself — registering them here * // applies them to *both* api functions and the GraphQL endpoint: * server.register(compress, { global: true }) * }, * configureApiServer: (server) => { * // Configure just the api functions' fastify instance, e.g. add * // content type parsers. Doesn't apply to the GraphQL endpoint. * }, * configureGraphQLServer: (server) => { * // Configure just the GraphQL fastify instance. Doesn't apply to * // api function routes. * }, * }) * * // Plain request-lifecycle hooks (onRequest, onSend, etc.) don't depend * // on registration order, so they can also be added to the returned * // instance after the fact and will still apply to both: * server.addHook('onRequest', myHook) * * // When ready, start the server: * await server.start() * } * * main() * ``` */ export declare function createServer(options?: CreateServerOptions): Promise; //# sourceMappingURL=createServer.d.ts.map