If this is a nodejs project, you will need express to get a webpage working.
A tutorial can be found here:
If this not a nodejs project and is just html, css and js, then you will need a “index.html” file in the main directory (/app) which will be loaded automatically when viewing your glitch.me page!
Hey @vegeta400, both of those projects look like they’re intended to be static html-only websites, but since they both have package.json files Glitch expects them to be Node projects and doesn’t know what to do with them. If you’re working on a static site, your can delete or rename package.json in each project and they should start serving your content.
Hope this helps!
@cori I need package.json for user process.env
Hey @vegeta400 I don’t really understand what you mean here.
process.env will only be accessible in NodeJS code, which there isn’t any of in your projects, and it’s not related to package.json directly (aside from the fact that having package.json is what tells Glitch you’re running a Node project. As things stand in those projects, the only thing removing package.json will do is to make it so that your index.html page is displayed properly.
Perhaps you can help us understand the bigger picture of what you’re trying to do so we can offer some specific guidance?
@cori I need to store data that cannot be seen by viewers
So to recap, you want to store some “private” information in your project’s environment variables (perhaps using a
.env file) and then to consume that private information in the rest of your project, do I have that right?
Nevertheless, if you want to access something from the environment you’re going to need to use Node for that, and not a simple HTML file. Since you’ve got a package.json file your projects are already running in “Node mode” so that part’s good, but you’ll need to switch to using something like Express to a) start something listening on your project’s open port (
process.env.PORT - typically 3000, but better to rely on Glitch to manage it for you), which will stop the project restarting issue and b) use something like Express’s sendFile() method to send your HTML file to your users.
Hope this helps!