Add application code

This commit is contained in:
Lalit Mohan Kalpasi 2026-03-17 14:49:22 +05:30
parent 3fa65cc391
commit cf185930bf
6 changed files with 49 additions and 2 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
npm-debug.log
.git
.gitignore

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
.env

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
EXPOSE 8080
CMD ["node", "index.js"]

View File

@ -62,9 +62,9 @@ serverlessConfig:
Scaling:
AutoStop: false
Min: 1
Max: 1
Max: 3
MaxIdleTime: 300
Resources:
CPU: 0.1
MemoryMB: 128
MemoryMaxMB: 128
MemoryMaxMB: 256

17
index.js Normal file
View File

@ -0,0 +1,17 @@
const express = require('express');
const app = express();
const PORT = process.env.PORT || 8080;
app.use(express.json());
app.get('/hello', (req, res) => {
res.json({ message: 'Hello from git-serverless!' });
});
app.get('/health', (req, res) => {
res.json({ status: 'ok' });
});
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});

11
package.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "git-serverless",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^4.18.2"
}
}