Create an Express JS App

Install the Express and Oracle db packages using npm package manager, which is included in the Node.js:

npm i express oracledb morgan

Create config/web-server.js in the application and paste the below code.

config/web-server.js

module.exports = {
port: process.env.HTTP_PORT || 3000
};

In Node.js the process object has an env property that contains user environment. Here we are set the value of port to the value of the environment variable HTTP_PORT. If that environment variable isn’t defined, the default value will be 3000.

For running the node application use the below command,

node filename

npm init -y

npm install bcryptjs npm install jsonwebsocket

npm i dotenv npm i nodemon

npm i –save-dev nodemon

require(‘crypto’).randomBytes(64).toString(‘hex’)

References

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04

Installing Node Oracledb Stack Overflow DB connection with node.js
GitHub Oracle db examples
Medium
Developing Node.js Applications for Oracle Database


Read More