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
Installing Node Oracledb
Stack Overflow DB connection with node.js
GitHub Oracle db examples
Medium
Developing Node.js Applications for Oracle Database
Use the share button below if you liked it.
It makes me smile, when I see it.