Merge pull request #9 from ghoshRitesh12/vercel
Add Vercel deployment support
This commit is contained in:
+3
-2
@@ -17,7 +17,8 @@ RUN npm run build
|
||||
FROM node:20-alpine as prod
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/ghoshRitesh12/aniwatch-api
|
||||
LABEL org.opencontainers.image.description="Aniwatch API docker image"
|
||||
LABEL org.opencontainers.image.description="Node.js API for obtaining anime information from aniwatch.to (formerly zoro.to) written in TypeScript, made with Cheerio & Axios"
|
||||
LABEL org.opencontainers.image.description "Node.js API for obtaining anime information from aniwatch.to (formerly zoro.to) written in TypeScript, made with Cheerio & Axios"
|
||||
LABEL org.opencontainers.image.licenses=MIT
|
||||
|
||||
# create a non-privileged user
|
||||
@@ -52,6 +53,6 @@ ENV PORT=4000
|
||||
# exposed port
|
||||
EXPOSE 4000
|
||||
|
||||
CMD [ "node", "dist/server.js" ]
|
||||
CMD [ "node", "dist/src/server.js" ]
|
||||
|
||||
# exit
|
||||
@@ -0,0 +1,3 @@
|
||||
import app from "../src/server.js";
|
||||
|
||||
export default app;
|
||||
+2
-1
@@ -8,6 +8,7 @@
|
||||
"start": "tsx src/server.ts",
|
||||
"dev": "tsx watch src/server.ts",
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"vercel-build": "echo \"Hello\"",
|
||||
"prepare": "husky install",
|
||||
"test": "jest",
|
||||
"healthcheck": "curl -f http://localhost:4000/health"
|
||||
@@ -49,6 +50,6 @@
|
||||
"jest": "^29.6.2",
|
||||
"ts-jest": "^29.1.1",
|
||||
"tsx": "^4.2.0",
|
||||
"typescript": "^5.1.6"
|
||||
"typescript": "^5.3.2"
|
||||
}
|
||||
}
|
||||
+13
-8
@@ -26,12 +26,17 @@ app.use("/anime", animeRouter);
|
||||
app.use(notFoundHandler);
|
||||
app.use(errorHandler);
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`⚔️ api @ http://localhost:${PORT}`);
|
||||
});
|
||||
if (!Boolean(process?.env?.IS_VERCEL_DEPLOYMENT)) {
|
||||
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);
|
||||
// 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;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "(.*)",
|
||||
"destination": "/api"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user