An open API service indexing awesome lists of open source software.

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

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