Remove .html and .js from URL

Hey, I’m creating a website on glitch however whenever I try to open the website I have to put the file extension into the URL, for example: I was wondering if there is any way of removing this from the URL so it becomes:

1 Like

1 Like


First of all, your project is must be hello-node. Then, you can use express npm module and insert this code to main file:

const Express = require ('express'),
      Application = Express ()

Application.get ('/', (Request, Response) => { /* You can edit '/' part, for ex. as '/example' */
  Response.sendFile (__dirname + '/example-folder/example.html')

Application.listen (3000, () => {
  console.log ('Hello World!')