aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2023-11-29 19:32:09 +0530
committerGitHub <[email protected]>2023-11-29 19:32:09 +0530
commitc15c194031ca5053d2cd143336544271b176ad93 (patch)
treed6bb7d52c128eda8f124d6c5a70aa9ecb93b5e8c /src
parentb9cf76d9aeb70e2dc1e5f2c31ec580f018a96812 (diff)
parentc079bf808ab2e6ec7fa58832f842b05e6212111a (diff)
downloadaniwatch-api-c15c194031ca5053d2cd143336544271b176ad93.tar.xz
aniwatch-api-c15c194031ca5053d2cd143336544271b176ad93.zip
Merge pull request #9 from ghoshRitesh12/vercel
Add Vercel deployment support
Diffstat (limited to 'src')
-rw-r--r--src/server.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/server.ts b/src/server.ts
index c10b91f..31f53ab 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -26,12 +26,17 @@ app.use("/anime", animeRouter);
app.use(notFoundHandler);
app.use(errorHandler);
-app.listen(PORT, () => {
- console.log(`⚔️ api @ http://localhost:${PORT}`);
-});
-
-// don't sleep
-setInterval(() => {
- console.log("HEALTHCHECK ;)", new Date().toLocaleString());
- https.get("https://api-aniwatch.onrender.com/health");
-}, 540000);
+if (!Boolean(process?.env?.IS_VERCEL_DEPLOYMENT)) {
+ app.listen(PORT, () => {
+ console.log(`⚔️ api @ http://localhost:${PORT}`);
+ });
+
+ // don't sleep
+ // remove the setInterval below for personal deployments
+ setInterval(() => {
+ console.log("HEALTHCHECK ;)", new Date().toLocaleString());
+ https.get("https://api-aniwatch.onrender.com/health");
+ }, 540000);
+}
+
+export default app;