Topic: Contact Form - NodeJS

gilrou priority asked 2 years ago


Good night, The "Contact Form - NodeJS" example in

https://mdbootstrap.com/docs/standard/integrations/contact-form-nodejs/#section-connect-frontend-with-backend

in the paragraph "Now add /config/index.js file that will read all your environment variables."

displays a line with NODE_ENV,.

When running the server.js file it gives an error like "Uncaught ReferenceError: NODE_ENV is not defined"

How should I proceed? Deleting the NODE_ENV line in /config/index.js, no more error (obviously).

However, the application does not send email!

Thanks in advance, sincerely, gilrou


Grzegorz Bujański staff answered 2 years ago


This is a documentation error. Sorry for that. We've already corrected this. The correct code is:

require('dotenv').config();

module.exports = {
  PORT: process.env.PORT || 3000,
  NODE_ENV: process.env.NODE_ENV,
  MAIL_HOST: process.env.MAIL_HOST,
  MAIL_PORT: process.env.MAIL_PORT,
  MAIL_USERNAME: process.env.MAIL_USERNAME,
  MAIL_PASSWORD: process.env.MAIL_PASSWORD,
  MAIL_TO: process.env.MAIL_TO
};


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 4.3.0
  • Device: macbookpro
  • Browser: safari
  • OS: macosmonterey 12.4
  • Provided sample code: No
  • Provided link: Yes