feat: add healthcheck endpoint

This commit is contained in:
Elias Schneider
2023-04-27 22:31:06 +02:00
parent e5071cba12
commit 5132d177b8
2 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
import axios from "axios";
import { NextApiRequest, NextApiResponse } from "next";
import getConfig from "next/config";
const { apiURL } = getConfig().serverRuntimeConfig;
export default async (req: NextApiRequest, res: NextApiResponse) => {
const apiStatus = await axios
.get(`${apiURL}/api/configs`)
.then(() => "OK")
.catch(() => "ERROR");
res.status(apiStatus == "OK" ? 200 : 500).send(apiStatus);
};