title: Node.js and mysql bulletin board search function questions
body: <p>The bulletin board is being implemented using node.js and mysql. I'm going to implement a search function this time. This is how the search form appears in the home and finally appears as a search page after processing in the controller. However, the table should be the same as the database and search form string. If it's not accurate, it won't come out.</p>
  
  <p>form</p>
  
  <pre><code>    form(action=routers.search, method="get")
          input(type="text" placeholder="searh", name="result")
          input(type="submit" value="searh")
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>export const search = (req, res) =&gt; {
    try {
      let result_value = req.query.result;
      let sql =
        "SELECT id, folder, title, nicName, date_format(writeDate, '%Y/%m/%d %T') as writeDate FROM board  where title=? order by id desc ";
      dbConnection.query(sql, [result_value], (err, result) =&gt; {
        if (err) {
          console.log(err);
        } else {
          console.dir(result);
          res.render("search", {
            homeName: "watchingame",
            pageName: "search",
            routers,
            result_value,
            result
          });
        }
      });
    } catch (err) {
      console.log(err);
    }
  };
  </code></pre>
  
  <p>view</p>
  
  <pre><code>extends layouts/layout
  block content
      div
          h2 #{result_value}
      table
          each board in result
              tr
                  td=board.id
                  td
                      a(href=`/board${routers.boardDetail(board.id)}`)=board.title
                  td=board.nicName
                  td=board.writeDate
      a(href=`/board${routers.boardCreate}`) write
  </code></pre>