Topic: Contact Form - NodeJS
Good night, The "Contact Form - NodeJS" example in
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
                                                                                        answered 3 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
};
                                                                                    FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
 - 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