title: How to use DialogFlow, node.js v2 library without Firebase
body: <p>I'm trying to figure out how to use DialogFlow with express/bodyParser and the node.js library <strong>v2</strong> functions <strong>without Firebase</strong> (on my own server). I have it working with the request/response JSON data, but I can't figure out what I need to do to use the node.js library function <strong>dialogflow()</strong>. Here's a snippet of what I have that's working with the JSON data:</p>
  
  <pre><code>const {config} = require('./config');
  const https = require('https');
  const express = require('express');
  const bodyParser = require('body-parser');
  const fs = require('fs');
  
  const options = {
      key: fs.readFileSync(config.SSLDIR + 'privkey.pem'),
      cert: fs.readFileSync(config.SSLDIR + 'cert.pem'),
      ca: fs.readFileSync(config.SSLDIR + 'chain.pem')
  };
  
  const eapp = express();
  eapp.disable('x-powered-by');
  eapp.use(bodyParser.urlencoded({extended: true}));
  eapp.use(bodyParser.json());
  
  const server = https.createServer(options, eapp).listen(config.LISTEN_PORT, () =&gt; {
      console.log(`API listening on port ${config.LISTEN_PORT}. Ctrl-C to end.`);
  });
  server.on('error', (e) =&gt; {
      console.log(`Can't start server! Error is ${e}`);
      process.exit();
  });
  
  // I have an Agent class that reads the request object and handles it
  eapp.post("/actions", (request, response) =&gt; {
      const agent = new Agent(request, response);
      agent.run();
      return;
  });
  
  eapp.all('*', (request, response) =&gt; {
      console.log("Invalid Access");
      response.sendStatus(404);
  });
  </code></pre>
  
  <p>The only solution posted online that I could find said to use the following code:</p>
  
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const { dialogflow } = require('actions-on-google');
  const app = dialogflow();
  express().use(bodyParser.json(), app).listen(3000);
  </code></pre>
  
  <p>But I'm confused about:</p>
  
  <ol>
  <li><p>DialogFlow fulfillment requires an https endpoint, so don't I have
  to create an https server like I did?</p></li>
  <li><p>How can I integrate this example into what I've already done to stop
  using the JSON data and start using the node.js functions from 
  <strong>app=dialogflow()</strong> in the library?</p></li>
  </ol>