How does one update packages on this let's chat app?

I am a longtime developer getting up to speed on Node. I understand how a basic node/express/connect/etc. app works. However, I’ve created a site based on the Let’s Chat repo, and am having a hard time understanding how it works within Glitch. Specifically, I don’t understand how it starts, given there is no package.json or “start”:“node app.js” that I can find. I am able to clone the repo, put a db connection in the default.yaml, and it all works as expected. That’s great, but I’m not clear where I would add or update packages. Some specific questions:

I assume app.js is the “entry point” but how does Glitch know to start node at all?
Where is the equivalent to the start command that other sites typically have in package.json?
Does Glitch do anything with those docker files in /docker?

Bonus question: You’re supposed to be able to put the connection string in an LCB_DATABASE_URI environment variable in .ENV instead of default.yaml. This would be better for Glitch, but the app doesn’t seem to read this correctly- it only works with default.yaml, not .ENV. Is this a bug in Let’s Chat or something unique to the Glitch environment?

I’m sure all of this is just my ignorance- any help pointing me in the right direction here would be appreciated. Here is a glitch with my connection string removed: https://glitch.com/edit/#!/wry-expert

Hey danroot,

To update a package in an app, simply update the package.json file to specify the new version. On changes to this file, the project will fetch the updated dependencies for you.

We tried to make things as conventional as possible. Where your app starts is actually defined in the package.json:

    "start": "node server.js"
  },

Your project is private so I can’t see it , but generally to access a value from the .env file, you’ll need to use process.env.MYVAR. Depending on how you’re calling the values from yaml vs env this might the issue.

@pketh -Thanks for a quick reply. I’ve made the project public. In this case, there is no “package.json”, and that is what is confusing me. There is an app.json, but it doesn’t have “start”:“node app.js” or a list of packages.

It looks like there is a package.json file in the repo you’ve cloned (assuming it was https://github.com/sdelements/lets-chat), so I think it probably is there it’s just getting hidden due to the max file limit (100 files) that can be shown in the file tree on Glitch. Try (temporarily) adding a directory like ‘app/*’ to .gitignore and refreshing, you should then be able to see the other files, and hopefully, that will include package.json.

Ahhh. That’s it. Didn’t know about the limit. Thanks - this makes so much more sense now :wink:

Yeah, it can be confusing - we’re thinking about how to better handle that situation.

1 Like