dashpresshq/dashpress

View on GitHub
src/pages/api/config/[key]/__guest.ts

Summary

Maintainability
A
1 hr
Test Coverage
A
100%
import { configurationApiController } from "@/backend/configuration/configuration.controller";
import { requestHandler } from "@/backend/lib/request";

const REQUEST_QUERY_FIELD = "key";

export default requestHandler(
  {
    GET: async (getValidatedRequest) => {
      const validatedRequest = await getValidatedRequest([
        {
          _type: "requestQuery",
          options: REQUEST_QUERY_FIELD,
        },
      ]);

      return await configurationApiController.showGuestConfig(
        validatedRequest.requestQuery
      );
    },
  },
  [
    {
      _type: "anyBody",
    },
  ]
);