42 lines
1.0 KiB
YAML
42 lines
1.0 KiB
YAML
|
apiVersion: v1
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
name: node-app-configmap
|
||
|
namespace: node-app
|
||
|
data:
|
||
|
# Mensaje personalizado
|
||
|
message: "Este es un mensaje personalizado."
|
||
|
# file-like keys
|
||
|
# Archivo de app (Código)
|
||
|
app.js: |
|
||
|
const express = require('express')
|
||
|
const app = express()
|
||
|
const port = process.env.PORT ? process.env.PORT : 80
|
||
|
|
||
|
app.get('/', (req, res) => {
|
||
|
res.send(process.env.MESSAGE ? process.env.MESSAGE : 'Hello World!')
|
||
|
})
|
||
|
|
||
|
app.get('/secret', (req, res) => {
|
||
|
res.send(process.env.SECRET ? process.env.SECRET : 'Hello Secret World!')
|
||
|
})
|
||
|
|
||
|
|
||
|
app.listen(port, () => {
|
||
|
console.log(`Example app listening on port ${port}`)
|
||
|
})
|
||
|
package.json: |
|
||
|
{
|
||
|
"name": "show-text-app",
|
||
|
"version": "1.0.0",
|
||
|
"description": "example app",
|
||
|
"main": "app.js",
|
||
|
"scripts": {
|
||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||
|
},
|
||
|
"author": "Alejandro Lembke Barrientos",
|
||
|
"license": "MIT",
|
||
|
"dependencies": {
|
||
|
"express": "^4.18.1"
|
||
|
}
|
||
|
}
|