How do I access node_modules?

Hello,

I was looking for a way to hide sensitive information (api keys, etc). The secrets feature doesn’t seem to be enabled anymore. I saw another suggestion to move the file into the node_modules folder, so I did. Now I can’t access the file anymore. Here is the shell output:

$ ls -h
bookie.js.template  gitignore  index.html  node_modules  replit.nix  script.js  style.css
$ cd node_modules
bash: cd: node_modules: Not a directory
$ ls -h
bookie.js.template  gitignore  index.html  node_modules  replit.nix  script.js  style.css
$ cd .node_modules
bash: cd: node_modules: Not a directory

How can I move the file back into my ~/ ?

go to Tools > :lock: Secrets. If it isn’t there, it’s because you’re on a static hosting repl. You would have to use a webserver, and ensure secrets are used server-side and not in the frontend webpage.

1 Like

Thanks! Looks like I have static hosting. Does that mean I need to buy Hacker to get access to the feature?

Is there any way to get my file back? I was working on creating API urls in there and I would rather not have to start again from scratch if I don’t have to.

you might not want to get that file back. We’d be able to see it easily when we fork the repl.

By ‘static hosting’ I mean a HTML,CSS,JS repl. You’d have to instead use a webserver on a node.js repl (e.g. using es4x) which has a route which returns whatever info you need to extract using your secret, and use fetch client-side.

1 Like

NodeJS is fine. Another option is Python Flask. It’s up to you.

you might not want to get that file back. We’d be able to see it easily when we fork the repl.

That is good to know, thanks. I still want it back so I can get the work I’ve already done. I will look into creating a separate project for the API calls.

1 Like

I was able to get the information back!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.