Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
Is it possible to take this API route and implement it into a command when a entire is made in a javascript html file

So I have a api route similar to the one that is shown below. It takes an sql command and then executes it, then returns the value in json format. I want to do this when a entry is made in a javascript webpage. Is is something that is possible

@app.route('/api/getdata', methods = ['GET'])
def insert_restaurant():
    getuser = "SELECT name FROM restaurants ORDER BY RAND() LIMIT 1;" # This statement witll return the random restaurant tha the users have entered
    conn = create_connection("", "", "", "")
    getting_users = execute_read_query(conn, getuser)
    return jsonify(getting_users)

the way that I am learning the node js stuff is similar to this. when the form is filled out it will go to the website, search, and then return the output

app.post('/process_form', function(req, res){
    // create a variable to hold the username parsed from the request body
    var search = req.body.search
    // Now we will use the token wiht the name that the user entered
    // For this we will use the axios method to return the result
    axios.get('https://itunes.apple.com/search?term='+search)
    .then((response)=>{
        var songlist = response.data.results;
        console.log(songlist);
// Now we will execute the results in the page named thanks
        res.render('pages/thanks.ejs', {
            songlist: songlist,
            search: search
        });
    });
});

How can I implement the first command so that it would execute like the second command? is what I am saying even making sense? I am just lost

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda