dashpresshq/dashpress

View on GitHub
src/pages/api/healthcheck/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
92%
import { dataApiService } from "@/backend/data/data.service";
import { requestHandler } from "@/backend/lib/request";
import { schemasApiService } from "@/backend/schema/schema.service";
import { noop } from "@/shared/lib/noop";

export default requestHandler(
  {
    GET: async () => {
      try {
        await dataApiService.runOnLoad();
        await schemasApiService.runOnLoad();
      } catch (error) {
        noop();
      }
      return {
        ok: true,
      };
    },
  },
  [
    {
      _type: "anyBody",
    },
  ]
);