Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!