Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sclorg/nodejs-ex
node.js example
https://github.com/sclorg/nodejs-ex
Last synced: 3 months ago
JSON representation
node.js example
- Host: GitHub
- URL: https://github.com/sclorg/nodejs-ex
- Owner: sclorg
- License: apache-2.0
- Fork: true (ryanj/node-echo)
- Created: 2015-04-24T17:04:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-26T15:18:19.000Z (8 months ago)
- Last Synced: 2024-06-20T05:47:33.518Z (5 months ago)
- Language: HTML
- Homepage:
- Size: 751 KB
- Stars: 367
- Watchers: 69
- Forks: 9,148
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Node.js CI](https://github.com/nodeshift-starters/nodejs-rest-http-crud/workflows/ci/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/nodeshift-starters/nodejs-rest-http-crud/badge.svg?branch=master)](https://coveralls.io/github/nodeshift-starters/nodejs-rest-http-crud?branch=master)Example CRUD Application
### Getting Started
#### Running Locally
First, install the dependencies
`npm install`
A Postgres DB is needed, so if you are using Docker, then you can start a postgres db easily.
`docker run --name os-postgres-db -e POSTGRESQL_USER=luke -e POSTGRESQL_PASSWORD=secret -e POSTGRESQL_DATABASE=my_data -d -p 5432:5432 centos/postgresql-10-centos7`
In this example, the db user is `luke`, the password is `secret` and the database is `my_data`
You can then start the application like this:
`DB_USERNAME=luke DB_PASSWORD=secret ./bin/www`
Then go to http://localhost:8080
Other options:
* `npm run dev` same as `npm start` but with pretty output log.
* `npm run dev:debug` shows debug information.#### Running on Openshift
First, make sure you have an instance of Openshift setup and are logged in using `oc login`.
Then create a new project using the `oc` commands
`oc new-project fun-node-fun`
For this example, you will also need a postgres db running on your Openshift cluster.
`oc new-app -e POSTGRESQL_USER=luke -ePOSTGRESQL_PASSWORD=secret -ePOSTGRESQL_DATABASE=my_data centos/postgresql-10-centos7 --name=my-database`
Then run `npm run openshift` to deploy your app
Run the following command to show the newly exposed route that you can navigate:
```
oc get route nodejs-rest-http-crud
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
nodejs-rest-http-crud nodejs-rest-http-crud-opentel.apps-crc.testing nodejs-rest-http-crud 8080 None
```
#### Running on Openshift with traces enabled* [Read more](./OTEL.md)