Problems with app.get error: No routes matched location "/myapp/temp3"

Hello Im trying to connect with my database made with Clever Cloud, and I get that error "No routes matched location “/myapp/temp3” Could anyone help me?
My code:
const express = require(‘express’);
const app = express();
const mysql = require(“mysql2”);
const cors = require (“cors”);
const https = require(‘https’);

// Configuración de CORS
const corsOptions = {
origin: ‘https://glitch.com’,
// O permitir todas las solicitudes (no recomendado para producción):
// origin: ‘*’,
};

app.use(cors(corsOptions));

const db =mysql.createPool({
host: “bfc4fsjjygwtzndx6rfi-mysql.services.clever-cloud.com”,
user: “ujpnuh5l7vmyecuq”,
password: “***”,// (I erase this on purpose)
database: “bfc4fsjjygwtzndx6rfi”,
port: 3306,
}
);

app.get(‘/myapp/temp/’, (req, res)=>{

console.log('Prueba');

});

app.get(‘/myapp/temp2/’, (req, res)=>{

const q= “SELECT Nombre, Apellido FROM basecolabora”;
db.query(q, (err,data)=> {

if(err){return res.json(err);}
else {
console.log(data)}
})

});

app.get(‘/myapp/temp3/’, (req, res)=>{
const q= “SELECT * FROM basecolabora”;
db.query(q, (err,data)=> {

if(err) return res.json(err)
return res.send(data);
})

});
const PORT = process.env.PORT || 3000;

app.listen(PORT, () => console.log(Application is running on port ${PORT}));

I think you need to put the trailing slash in the address, it’s strict about those things

1 Like