DEV Community

I am getting undefined object when I use req.query.search in express

Sanket N Jain on July 03, 2020

node js code: var express = require("express"); const axios = require("axios"); var app = express(); app.set("view engine", "ejs"); app.get("/"...
Collapse
 
hangindev profile image
Jason Leung 🧗‍♂️👨‍💻

Hi Sanket! The name attribute should be placed on the input element.

<form action="/results" method="GET">
    <input type="text" placeholder="search term" name="search">
    <input type="submit">
</form>
Collapse
 
sanketnjain5 profile image
Sanket N Jain

Thank you!