I have created a set of EJS templates under /views/pages/ (e.g. meditations.ejs) and defined static routes in my routes.js like so:
app.get('/meditations', (req, res) => {
res.render('pages/meditations', { layout: 'layouts/main' });
});
These are registered in server.js using:
const routes = require('./setup/routes');
routes(app);
But navigating to http://127.0.0.1:3000/meditations gives me Cannot GET /meditations. Other routes (like /) are working.
I have confirmed:
• The file exists: views/pages/meditations.ejs
• The main.ejs layout is in place
• Wappler server is running, and the console shows no errors
I would really appreciate any help debugging what might be preventing the route from resolving.
Wappler handles all the page and routes creation itself when you are creating the page in the page manager. You will see the route later on in the Routing manager.
So you don't have to code anything, just use the standard Wappler functionality.
You should not edit the files in the lib folder. When you use the UI the routes are stored in app/config/routes.json. The server will read the config file and setup the routes.