How do i see other files in the main views folder

On my project, I was building a blog and I am not able to use installer.php even though I changed the app.get. How do I fix it?

Project: https://glitch.com/~somerandomblog

EDIT: fixed markdown

To run PHP in Glitch, you need to have a webserver and here’s how you do it:

  1. Create a file called glitch.json.

  2. The glitch.json should have the following code to run PHP:

{
"start": "php -S 0.0.0.0:3000 -t .",
"install": "echo 'we are ready!'"
}

Hope this helps!

Hey @daviddoesgacha!

Additionally, check out glitch~php-poc and glitch~lamp-poc for example.

1 Like

Thank you both but I also have another question. I still can’t see other files other than index.html in my other folders. How do I fix that?

Sorry, I’m new to Glitch (somewhat).

@daviddoesgacha

I’m gonna let one of our developers provide some help here. Stand by!

Hi @daviddoesgacha!

I think you’re trying to use a mixture of Node.js and php, and that can work, but it’s tricky.

I would recommend either using just Node.js (similar to ~hello-express, with no PHP) or just PHP (the way khalby786 describes).

In particular, you have some code like this:

app.get("/", function(request, response) {
  response.sendFile(__dirname + "/views/installer.php");
});

That is going to send the source code of installer.php to the browser - it’s not going to render it to HTML like a PHP webserver would - and then the browser is going to recognize that it’s not HTML, and it download the installer.php file instead of showing anything.

It looks like you are trying to use “HTMLy”. We don’t have a starter kit for HTMLy specifically, and using PHP on Glitch is harder than using Node.js on Glitch. I would recommend 11ty instead. See https://www.11ty.dev/ for information about it and remix ~11ty to get started.

Hope this helps,

Johnicholas

1 Like