Whats the way glitch starts html code?

Cannot GET / when i try localhost, here is the code I think its erroring on.

**const express = require(“express”);

const app = express();

app.get("/index.html", (request, response) => {




const listener = app.listen(process.env.PORT, () => {

console.log("Your app is listening on port " + listener.address().port);



thats all i have in my script.js.

how would i fix this? @RiversideRocks

In that case, visit index.html


What are you asking? You should also not use index.html in Express routing, you should use /

but then it says it cant find it?

Hello @mynamecolt420, what you need is an application to serve your static files over the internet, or your local network.

In almost every programming language there is a way to do that, however the one I find easiest is using Node.js and Express. After installing node you can open up a shell (command prompt or terminal), I suggest you navigate to a testing directory.

When you have a directory set for this you can start by executing the following commands:

npm init -y # Initiate a new project or package.
npm i -S express # Save express as one of your dependencies.

After that you can open up your preffered text editor and create a file called index.js inside of that directory and write the following code:

// Fetch dependencies.
const Express = require("express");

// Create an express application.
const App = Express();

// Use a static site middleware provided by express.
App.use(Express.static(__dirname + "/public"));

// Start the web server.
App.listen(process.env.PORT || 3000, () => console.log("🚀 The server is listening on"));

Now create a file located in path/to/dir/public/index.html

    <meta charset="utf-8" />
    <title>My Static Webpage</title>
    <h1>Hello world</h1>

The you run your app by running the following command node . inside of the directory.

1 Like

It is node . or node yourservername.js.

Thanks for clearing up the small confused mess of answers! :slightly_smiling_face::stuck_out_tongue_closed_eyes: