Okay… First of all, I know this topic sounds like something has been talking about on the Internet and I should found it so easy but, apparently not. At least what has been posted on the internet + StackOverflow + youtube is not exactly my situation. And as a newbie to Node.js it is very fustrasting.
So please help me out or point me to the right tutorail… please…
I am making a project that use Twiiter API keys so I would like to hide those from the public.
I know that to hide those key the best way is to create a server side something with Node.js and with Express.js thing could be easier.
My program use codebird.js to search for tweets and there is this cd(key,secretkey),… < to pass the keys into. When I use .env with Node.js/Express.js it did not go to the client side, which of couse then the key will be exposed to the public. I have tried serveral ways including working with PHP but nonetheless if I work with codebord.js the way I do now people still can see my keys from console.
I have a feeling that Glitch.com probably have a better way with this. It sounds so simple but I know I have missed something and my limited knowledge can’t solve it on my own.
My project has been organized like this:
index.html
sketch.js
style.css
/data/
/lib/
package.json
node.module
index.js
const express = require("express");
const app = express();
const listener = app.listen(process.env.PORT, () => {
console.log("Your app is listening on port " + listener.address().port);
});
When I try to run locally on my computer index.js didnot work on browser which I guess is somehow with my firewall but can give me the console.log() on terminal. I can’t test on glitch because I am fail to do so nothing work here.