Nodejs new project 404

Hi
Hoping someone could point me in the right direction, I am starting a new project, I want to have a go at building an ecom site and use wappler to do it. I have built other sites in php in wappler and had pretty good success, but want to try nodejs.

So, I setup a new project, i have latest wappler 6.8, nodejs, running in docker. I know docker works as i put an index.html file in the public folder and it delivered it.

But I cannot get any node pages to show, i have the main page layout and index file created with the project, but i just get error 404, its new project fresh out the box



Screenshot 2024-07-19 160223

for the life of me i cannot get beyond this :frowning:

thanks

Did you click Deploy button?

The root route should link to the index page, so the url should be http://localhost:8100/.

Does it link to that url if you click the open in browser icon with the editor or how did you open it in the browser?

yeah its deployed and green and says its all up and running and I know docker is listening and working as i put index.html in the public folder and if i got to localhost:8100/index.html it gives me my page.

I have just noticed actually that all the fiels are under the views folder, nothing is in public, so that explains the 404, but i dont seem to be able to create a page in public

now trying to move files around I have messed things up, as thre was index.js file that i am not sure where to move it back to. thought this would be simple, spin up a project create a file and edit templates, as per guides I watched.

ho hum

ejs template files belong in the views folder, when you would place them in the public folder they don't get rendered but served directly.

Check if there is a route setup for the specific page.

I'd suggest if it is the early stages of the Project and nothing is to be lost then delete it (the Project) and start over. You should not be using html for in a Node Project. Don't waste time when a new Project can put you straight back on track within a few minutes...

1 Like

yeah I am going to. i only popped an index.html to see if the problem was docker.

going to have to read around more, as i had this as fresh project, it created the page and template and i thought it would display that page but it didnt, back to the drawing board
thanks

Start slowly and don't rush. Is easy to move too fast.

Start with the basics and gain an understanding. Will help a lot.

Although the UI is out of date the process is pretty much the same. Have a look at the below link:

https://docs.wappler.io/t/creating-template-based-pages-and-layout-in-wappler-with-nodejs/21430

thanks, will do, was trying to, i have new project now, but I thought pages that the public see would be under public, but it seems to want to put them under views, so it shows the project folder, to see public i click files, but is that right, pages i should create under public and then select the view for that page, just suprised not to see public folder not listed under the project folder by default

will check out the link you sent as well, thanks

The .ejs files are not supposed to be created in the public folder, you should not move files around.
If you just follow the docs and do what is shown there, you will have no problems running the pages.

1 Like

The public directory is for public facing assets for use in the pages which are stored under views. Views are where your pages are stored (templates are under layouts). Forget everything you did in PHP. When you add a new page do it from the pages area within Wappler. Then save it and the route will be added to the page and to the routing table.

1 Like

perfect thanks, got it, so just assets in public like images and css etc, and pages and templates under views, think i have it, now to get a page setup using a view with a route and see if i can get it to work, thanks everyone

Re-read the documentation. Like Teodor says it is all there clear as day. The process is exactly the same despite the UI being different within the documentation. Nothing else has changed. Wappler will take care of all the work for you as long as you follow the documentation you can not go wrong.

No, templates will be in layouts. Pages will be in views.