title: How to use POST , GET for making search-box in Nodejs
body: <p>I want to post and get the getparameter keyword from form value and use this query</p>
  
  <pre><code>SELECT * from cider.cid_contents 
  where con_content like \'%'+ keyword +'%\' 
  order by con_no desc;
  </code></pre>
  
  <p>But I don't know how to get the keyword value from post or form method.
  There are codes</p>
  
  <p>search.js</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var mysql = require("./model/mysql");
  
  /* GET home page. */
  router.post('/search/process', function(req, res, next) {
  
      var keyword = req.body.keyword;
  
      console.log(keyword);
  
      res.redirect('/search');
  
  
    });
  
  router.get('/search/:keyword', function(req, res, next) {
      var keyword;
      keyword = req.params.keyword;
      console.log("+++++");
      console.log(keyword+"1234");
      mysql.select('SELECT * from cider.cid_contents where con_content like \'%'+ keyword +'%\' order by con_no desc;',
  
  
      function (err, data){
          if (err) throw err;
  
      res.render('front/search/search', { contents : data});
    });
  });
  
  
  module.exports = router;
  </code></pre>
  
  <p>that's a form tag(top.ejs)</p>
  
  <pre><code>&lt;form action="/search/process" method="post"&gt;
                  &lt;input type="text" class="form-control web-search-box" placeholder="search" name="keyword" value=''&gt;&lt;/div&gt;
                  &lt;div id="search" class="search col-sm-1"&gt;&lt;img src="../../page_imgs/fixed_img/icon_search.png"&gt;&lt;/div&gt;
                  &lt;input type="submit" value="send"&gt;
                  &lt;/form&gt;
  </code></pre>
  
  <p>/search (search.ejs)</p>
  
  <pre><code>&lt;table class="bordered"&gt;
          &lt;thead&gt;
            &lt;tr&gt;
                &lt;th data-field="no"&gt;num&lt;/th&gt;
                &lt;th data-field="title"&gt;title&lt;/th&gt;
                &lt;th data-field="date"&gt;date&lt;/th&gt;
                &lt;th data-field="viewCount"&gt;count&lt;/th&gt;
                &lt;th data-field=""&gt;&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
  
          &lt;% for(var i = 0; i&lt;contents.length; i++) { %&gt;
              &lt;tr&gt;
  
                  &lt;td&gt;&lt;%= contents[i].con_no %&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;a href="/adm/contents/detail/&lt;%= contents[i].con_no %&gt;"&gt;&lt;%= contents[i].con_title %&gt;&lt;/a&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;%= contents[i].con_regDate %&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;%= contents[i].con_viewCount %&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;a href="/adm/contents/delete/&lt;%= contents[i].con_no %&gt;"&gt;delete&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;% } %&gt; 
          &lt;/tbody&gt;
        &lt;/table&gt;
  </code></pre>