List

create .env file dalam root projek directory
letak sckrip

NODE_ENV=development

remove semula skrip export dalam package.json (jika ada atau tambah)

“scripts”: {
“start”: “node app.js –verbose”,
“dev”: “export NODE_ENV=development && nodemon -q -w \”.\” –ext \”.\” -i \”node_modules\” –exec \” npm run start\” “,
“test”: “echo \”Error: no test specified\” && exit 1″
},
tambah line dalam file app.js kat bahagian atas
const express = require(“express”);
const bodyParser = require(“body-parser”);
require(‘dotenv’).config();
run utk install dotenv
#npm i –save dotenv
run app
#npm run dev

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