https://github.com/nerdingitout/form-bff
Express.js backend to perform queries to postgreSQL DB
https://github.com/nerdingitout/form-bff
Last synced: 12 months ago
JSON representation
Express.js backend to perform queries to postgreSQL DB
- Host: GitHub
- URL: https://github.com/nerdingitout/form-bff
- Owner: nerdingitout
- Created: 2021-12-09T10:43:58.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-20T11:40:42.000Z (over 4 years ago)
- Last Synced: 2025-05-14T10:32:11.639Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-hello-world
This is an example Express server, which serves an API.
Express is the "fast, unopinionated, minimalist web framework for Node.js".
To run:
npm install
npm start
The app will now start on
If you hit you'll get a greeting:
$ curl localhost:3000/greeting
{"greeting":"Hello, world!"}
## Put it in a container
Build a Docker image:
docker build -t node-hello-world .
Now start a container from the image:
docker run --network=host node-hello-world
You'll be able to access the API at .
## Run on OpenShift environement
- you can create the application on Red Hat OpenShift using ```oc new-app``` command, YAML deployments that reside in ```k8s``` folder, or using OpenShift Pipelines.
- Once deployed, make sure to connect to your postgreSQL database by creating a secret in each environment using the following command. Make sure to replace the values with the right credentials for each variable. Leave port 8080 as is.
```
oc create secret generic postgredb-secret --from-literal=DB_USER= --from-literal=DB_PASSWORD= --from-literal=DB_HOST= --from-literal=DB_PORT= --from-literal=DB_NAME= --from-literal=PORT=8080
```
- Then set the secret you create as environment variable for your application
```
oc set env --from=secret/postgredb-secret deployment/form-bff
```
## Acknowledgements
This app was created using the [Express application generator][expressgen].
[express]: https://expressjs.com/
[expressgen]: https://expressjs.com/en/starter/generator.html