title: How to setup express js server with firebase hosting?
body: <p>I am trying to make an app using Instagram's real-time api. I want to use Firebase to host my server. Below is my folder structure:</p>
  
  <pre><code>-main.js (instagram get and post requests here)
  -server.js (setup express server here)
  -firebase.json
  -public (all firebase files)
    --index.html
    --scripts
    --styles
  </code></pre>
  
  <p>I first make my subscription to Instagram by typing this in my command line:</p>
  
  <pre><code>curl -F 'client_id=7be53c459291486ead4916048ac434ad' \
   -F 'client_secret=88ad262f9e57481bbf1ea7312d179a50' \
   -F 'object=tag' \
   -F 'aspect=media' \
   -F 'object_id=turtles' \
   -F 'callback_url=https://instagram-slideshow.firebaseapp.com/callback' \
   https://api.instagram.com/v1/subscriptions/
  </code></pre>
  
  <p>I get an invalid response when I make the subscription request. Where should I put my server code? In my public folder? I cannot find any examples on how to use firebase to host your server. Can someone show me an example?</p>
  
  <p>This is my server.js code:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  require('./app.js')(app);
  
  var server = app.listen(3000, function () {
    var host = server.address().address;
    var port = server.address().port;
    console.log('Example app listening at http://%s:%s', host, port);
  });
  </code></pre>
  
  <p>And this is my main.js</p>
  
  <pre><code>module.exports = function(app){
  // when instagram tries to GET my URL, I need to return the hub.challenge and hub.verify_token
  app.get('/callback', function (req, res) {
    res.send('Hello World!');
    if(req.param("hub.verify_token") == "myVerifyToken") {
      res.send(req.param("hub.challenge"));
    }
  
    else {
      res.status(500).json({err: "Verify token incorrect"});
    }
  });
  
  // when instagram sends a post request to my server, check for updates on my end
  app.post('/', function (req, res) {
    res.send('POST request to the homepage');
  });
  }
  </code></pre>