mirror of
https://github.com/coollabsio/coolify-examples.git
synced 2026-02-20 06:18:57 +00:00
new examples
This commit is contained in:
1
node/expressjs/.dockerignore
Normal file
1
node/expressjs/.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
1
node/expressjs/.gitignore
vendored
Normal file
1
node/expressjs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
15
node/expressjs/README.md
Normal file
15
node/expressjs/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Express.js
|
||||
|
||||
A simple HTTP server using Express.js.
|
||||
|
||||
## Getting Started
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
- `GET /` - Returns `{"message": "Hello from Express.js!"}`
|
||||
- `GET /health` - Returns `{"status": "ok"}`
|
||||
28
node/expressjs/index.js
Normal file
28
node/expressjs/index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Runtime env vars (read at server startup)
|
||||
const RUNTIME_PRIVATE_VAR = process.env.RUNTIME_PRIVATE_VAR || 'default-value';
|
||||
const RUNTIME_PUBLIC_VAR = process.env.RUNTIME_PUBLIC_VAR || 'default-value';
|
||||
|
||||
console.log('=== Runtime Variables ===');
|
||||
console.log('RUNTIME_PRIVATE_VAR:', RUNTIME_PRIVATE_VAR);
|
||||
console.log('RUNTIME_PUBLIC_VAR:', RUNTIME_PUBLIC_VAR);
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.json({
|
||||
message: 'Hello from Express.js!',
|
||||
runtimePrivateVar: RUNTIME_PRIVATE_VAR,
|
||||
runtimePublicVar: RUNTIME_PUBLIC_VAR,
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({ status: 'ok' });
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
||||
14
node/expressjs/package.json
Normal file
14
node/expressjs/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "expressjs-webserver",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple backend webserver written in Express.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.21.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user