This commit is contained in:
Abhishek Test Tiwari 2026-03-17 14:37:38 +05:30
parent 8ccea88f08
commit 486b50bf87
8 changed files with 67 additions and 257 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM node:20-alpine
WORKDIR /app
COPY package.json ./
COPY app.js ./
EXPOSE 8080
CMD ["node", "app.js"]

17
app.js Normal file
View File

@ -0,0 +1,17 @@
const http = require('http');
const PORT = 8080;
const server = http.createServer((req, res) => {
if (req.method === 'GET' && req.url === '/') {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('7thhh updateee Hello World');
} else {
res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('Not Found');
}
});
server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});

36
boltic-properties.yaml Normal file
View File

@ -0,0 +1,36 @@
app: "anujbugtest"
serverlessId: "ce200692-ad45-4edd-b63b-f052f7ce51bb"
region: "asia-south1"
handler: "handler.handler"
language: "nodejs/20"
serverlessConfig:
Name: "anujbugtest"
Description: ""
Runtime: "git"
# Environment variables for your serverless function
# To add env variables, replace {} with key-value pairs like:
# Env:
# API_KEY: "your-api-key"
#TO add port map, replace {} with port map like:
# PortMap:
# - Name: "port"
# Port: "8080"
# Protocol: "http"/"https"
Env: {}
PortMap: {}
Scaling:
AutoStop: false
Min: 1
Max: 1
MaxIdleTime: 300
Resources:
CPU: 0.1
MemoryMB: 128
MemoryMaxMB: 128
Timeout: 60
Validations: null
build:
builtin: dockerfile
ignorefile: .gitignore

View File

@ -1,67 +0,0 @@
# ============================================================================
# Boltic Configuration File - helloworldpage
# ============================================================================
#
# ⚠️ WARNING: Changes to this file will directly impact your deployed application!
# - Env changes will update environment variables
# - Scaling changes will affect auto-scaling behavior
# - PortMap changes will modify exposed ports
#
# This file is synced with the Boltic UI. You can edit settings here or in the UI.
#
# ----------------------------------------------------------------------------
# SERVERLESS CONFIG GUIDE
# ----------------------------------------------------------------------------
#
# Environment Variables (Env):
# serverlessConfig:
# Env:
# MY_VAR: "my_value"
# DATABASE_URL: "postgres://..."
# API_KEY: "secret-key"
#
# Port Mapping (PortMap):
# serverlessConfig:
# PortMap:
# - Name: "testhttp"
# Port: 8080
# Protocol: "http"
# - Name: "test https"
# Port: 9090
# Protocol: "https"
#
# Scaling Configuration:
# serverlessConfig:
# Scaling:
# AutoStop: true # Auto-stop when idle
# Min: 1 # Minimum instances
# Max: 5 # Maximum instances
# MaxIdleTime: 300 # Seconds before auto-stop
#
# Resources:
# serverlessConfig:
# Resources:
# CPU: 0.5 # CPU cores (0.1 to 4)
# MemoryMB: 256 # Memory in MB
# MemoryMaxMB: 512 # Max memory in MB
#
# Timeout:
# serverlessConfig:
# Timeout: 120 # Request timeout in seconds
#
# For more info: https://docs.boltic.io/docs/compute/serverless/application-config
# ============================================================================
app: helloworldpage
language: nodejs/18
region: asia-south1
serverlessConfig:
Scaling:
AutoStop: false
Min: 1
Max: 1
MaxIdleTime: 300
Resources:
CPU: 0.1
MemoryMB: 128
MemoryMaxMB: 128

View File

@ -1,26 +0,0 @@
function toNumber(value) {
const n = Number(value);
return Number.isFinite(n) ? n : 0;
}
function updateSum() {
const aEl = document.getElementById("numA");
const bEl = document.getElementById("numB");
const resultEl = document.getElementById("result");
if (!aEl || !bEl || !resultEl) return;
const sum = toNumber(aEl.value) + toNumber(bEl.value);
resultEl.value = String(sum);
}
document.addEventListener("input", (e) => {
const target = e.target;
if (!(target instanceof HTMLElement)) return;
if (target.id !== "numA" && target.id !== "numB") return;
updateSum();
});
document.addEventListener("DOMContentLoaded", () => {
updateSum();
});

View File

@ -1,97 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello World</title>
<style>
:root {
color-scheme: light dark;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
padding: 24px;
}
h1 {
font-size: clamp(2rem, 6vw, 4rem);
letter-spacing: -0.03em;
margin: 0;
}
.card {
width: min(520px, 100%);
border: 1px solid color-mix(in oklab, CanvasText 18%, transparent);
border-radius: 14px;
padding: 18px;
}
.stack {
display: grid;
gap: 14px;
}
.row {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 12px;
}
label {
display: grid;
gap: 6px;
font-size: 0.95rem;
}
input {
width: 100%;
padding: 10px 12px;
border-radius: 10px;
border: 1px solid color-mix(in oklab, CanvasText 18%, transparent);
background: Canvas;
color: CanvasText;
font-size: 1rem;
}
.op {
font-size: 1.6rem;
opacity: 0.8;
padding-top: 22px;
}
.result {
display: grid;
gap: 6px;
font-size: 0.95rem;
}
.hint {
opacity: 0.7;
font-size: 0.9rem;
line-height: 1.35;
}
</style>
</head>
<body>
<div class="card stack">
<h1>Hello World</h1>
<div class="row" aria-label="Addition inputs">
<label>
Number A
<input id="numA" type="number" inputmode="numeric" placeholder="e.g. 10" />
</label>
<div class="op" aria-hidden="true">+</div>
<label>
Number B
<input id="numB" type="number" inputmode="numeric" placeholder="e.g. 5" />
</label>
</div>
<div class="result" aria-label="Result">
Result
<input id="result" type="text" readonly value="0" />
<div class="hint">Type in either box to instantly see the sum.</div>
</div>
</div>
<script type="module" src="/handler.js"></script>
</body>
</html>

View File

@ -1,14 +1,9 @@
{
"name": "helloworldpage",
"private": true,
"name": "hello-world-app",
"version": "1.0.0",
"description": "Simple Hello World page",
"main": "server.js",
"description": "Simple Node.js Hello World app",
"main": "app.js",
"scripts": {
"start": "node server.js",
"dev": "node server.js"
},
"engines": {
"node": ">=18"
"start": "node app.js"
}
}

View File

@ -1,58 +0,0 @@
const http = require("node:http");
const fs = require("node:fs");
const path = require("node:path");
const PORT = Number.parseInt(process.env.PORT ?? "8080", 10) || 8080;
function sendText(res, statusCode, text) {
res.writeHead(statusCode, { "Content-Type": "text/plain; charset=utf-8" });
res.end(text);
}
function sendFile(res, filePath, contentType) {
fs.readFile(filePath, (err, data) => {
if (err) {
sendText(res, 500, "Internal Server Error");
return;
}
res.writeHead(200, {
"Content-Type": contentType,
"Cache-Control": "no-store",
});
res.end(data);
});
}
const server = http.createServer((req, res) => {
if (req.method !== "GET") {
sendText(res, 405, "Method Not Allowed");
return;
}
const url = req.url ?? "/";
if (url === "/" || url === "/index.html") {
sendFile(
res,
path.join(__dirname, "index.html"),
"text/html; charset=utf-8",
);
return;
}
if (url === "/handler.js") {
sendFile(
res,
path.join(__dirname, "handler.js"),
"text/javascript; charset=utf-8",
);
return;
}
sendText(res, 404, "Not Found");
});
server.listen(PORT, "0.0.0.0", () => {
// eslint-disable-next-line no-console
console.log(`Server running on http://0.0.0.0:${PORT}`);
});