Glitch Basics: How do I keep my project online 24/7?

Recently in the summer of 2020, Glitch banned pingers for good. However, there are still ways to keep your project online 24/7

  1. Static Projects. These are projects that don’t need to run any commands to operate. However, if you need to do stuff like download NPM packages, you can do this. Make one file called packages.js. Make sure it exports an array of packages like this:
module.exports = ["lodash", "ejs"];

Now make a file called null.config.js

const { spawn } = require("child_process");

const ls = spawn(
  "npm",
  ["install"]
    .concat(require("./packages.js"))
    .concat(["--no-package-lock", "--no-audit", "--production"])
);

ls.stdout.on("data", data => {
  console.log(data);
});

ls.stderr.on("data", data => {
  console.error(data);
});

ls.on("error", error => {
  console.error(`Error while executing command: ${error}`);
});

ls.on("close", code => {
  console.log(`child process exited with code ${code}`);
});

Now run refresh in your console. You only need to do this once. Congratulations, you now download css frameworks/javascript.

  1. Buy Glitch Boosted, solves all of your problems. Gives you more memory, disk space, and more CPU.
6 Likes

I see something very useful but that can be also exploited…

you can’t really exploit this