Starts the server with the provided options.

  • Type Parameters

    • WebsocketDataType = undefined

    Parameters

    • options: ServerOptions<WebsocketDataType>

      Configuration options for the server.

      Example usage:

      import { start, router, text, rateLimitMiddleware } from "@pulsar-http/core";

      const routes = [
      router.get("/api/users", async () => text("User List")),
      ];

      const middlewares = [
      rateLimitMiddleware({
      windowMs: 60000, // 1 minute
      maxRequests: 10,
      }),
      ]

      start({ routes, middlewares });

      In this example, the server will listen on port 3000 and respond to requests to "/api/users" with a plain text response of "User List".

      It will also apply rate limiting to restrict clients to 10 requests per minute.

    Returns void