List

Install knex

#npm i -g knex
#knex init

tambah #sudo jika perlu permision kt linux / mac
satu file knexfile.js akan create, boleh set connection

development: {
client:’oracledb’,
connection: {
host:’xxx’,
database:’xxx’,
user:’xxx’,
password:’xxx’
}
},
add line kat atas pada file controller
const knexfile = require(‘../knexfile’);
const knex = require(‘knex’)(knexfile[process.env.NODE_ENV]);
kemudian add ENV dalam package.json
“scripts”: {
“start”: “node app.js –verbose”,
“dev”: “set NODE_ENV=development && nodemon -q -w \”.\” –ext \”.\” -i \”node_modules\” –exec \” npm run start\” “,
“test”: “echo \”Error: no test specified\” && exit 1″
},
set untuk windows
export untuk linux
tukar kepada production jika dah sedia untuk live

Leave a Reply

Your email address will not be published. Required fields are marked *

  Posts

1 2
September 20th, 2021

FortiClient VPN 7 with MacOS Big Sur 11 Issue [SOLVED]

January 6th, 2021

Drupal 8 – PHPMailer SMTP

June 23rd, 2020

Drupal 8 – Setup composer dalam macOS

June 15th, 2020

Flutter (Mac OS) – Penyediaan Persekitaran

March 14th, 2019

Drupal 8 – Composer, Drush & Git

January 3rd, 2019

Node JS – Authentication using JSON Web Token (JWT)

January 3rd, 2019

Node JS – Set config ENV (dotenv)

January 3rd, 2019

Cara setup dan guna GitHub

January 2nd, 2019

Node JS – Connect to database Oracle with knex

January 2nd, 2019

Node Js – Training 2