title: How to check if a table exists in sqlite3 nodejs
body: <p>I am using Express for building an application, and on one endpoint, I have a table in sqlite3 being generated through this code </p>
  
  <pre><code>    db.serialize(() =&gt; {
          db.prepare(`CREATE TABLE IF NOT EXISTS ${req.body.tablename}(id TEXT)`).run().finalize();
          db.close();
      });
  </code></pre>
  
  <p>and then I have another endpoint that checks if the table exists using this code</p>
  
  <pre><code> db.get(`SELECT name FROM sqlite_master WHERE type='table' AND name=?`, req.param.name, (err, row) =&gt; {
          console.log(row) 
   });
  </code></pre>
  
  <p>But row comes out as undefined when I am 100% sure that the table was created and exists.</p>