Multiple pages returning with a Cannot GET

html
#1

I’ve been working on a small little project recently and I noticed there was a difficult and unclear way to make multiple pages. This one to be specific. I was wondering why and if you could create multiple pages simply through HTML (like you can practically anywhere else) and not through a unclear Express application.
image

#2

Hey @Warriorfoox, welcome to the Glitch forum!

If you’re simply looking to make a site consisting of HTML pages without server-side code using Node or Express you can start with the hello-webpage starter app which creates a static HTML-based site. If you already have those pages in your Node-based project from one of the other starters and you want to convert it to a static site you can delete or rename your package.json file and Glitch will start to treat that project as a static site.

Alternatively you could read up on Express’s static feature, which renders static HTML pages.

Using routing in Express as is exhibited in the answer you linked to is typically used for more complicated functionality that requires server-side logic as is noted in the page Gareth linked to in that answer. That answer was intended to be a very basic example of how you might perform those actions, I think.

If you’ve already set up those sort of routes then your site may be expecting to serve them at addresses without the views directory in the URL. If you need some specific guidance about the errors you’re running into it would be helpful to know your project name.

#3

Hello, sorry for not elaborating further. I also plan to code a Node.JS application (through Express, and will be passing Enmaps, Dotenvs, etc.) but I was hoping to make a friendly home page first with built-in redirects as I personally think it’s an unnecessary hassle to change pages by the server.js file instead of just like the following:

<a href="/views/audits.html">Audits</a>

If there’s anyway to make a system within the HTML5 code directly instead of porting it through an Express, that’d be helpful!

#4

bump, the project name is Paralyss. It is not re-mixable and the code is inaccessible due to it’s running a node software that’s connected to a token.

#5

Hey @Warriorfoox, I’m not really sure I understand what exactly you’re looking to do here that’s not already operational.

Maybe what you’re looking for is a way to add a link to your home page that sends the user to a plain HTML file without adding a route to server.js, so instead of what you’re doing in https://glitch.com/edit/#!/paralyss?path=views/index.html:24:0 and https://glitch.com/edit/#!/paralyss?path=server.js:20:0 you just want to drop a new HTML file in views/bot2.html and link to it using <a href="bot2.html>BOT2!</a> in index.html without touching server.js. Am I understanding what you hope to achieve correctly?