Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
Node.js Express - How to pass the API KEY to the public app.js

I added node and express to my project with dotenv to hide the API KEY I am using. Everything works fine but I cannot see how to pass the process.env.API_KEY to be used app.js file.

index.js

const express = require('express');
const app = express();
require('dotenv').config();

console.log(process.env.API_KEY);

app.listen(3000, () => console.log('Starting server: http://localhost:3000'));
app.use(express.static('public'));

app.js

document.addEventListener('readystatechange', (event) => {
    if (event.target.readyState === 'complete') {
        initApp();
    }
});

const initApp = () => {...}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!