daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Sep 25th, 2016 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=getquote.herokuapp.com request_id=c023a893-39df-48f3-adf1-3e3cfbf64c6f fwd="128.193.252.209" dyno= connect= service= status=503 bytes=
  2.    
  3. var mysql = require("mysql");
  4. var express = require("express");
  5.  
  6. var app = express();
  7. var port = process.env.PORT;
  8.  
  9. var favicon = require('serve-favicon');
  10. app.use(favicon(__dirname + '/favicon.ico'));
  11.  
  12. app.listen(port, function(){
  13.     console.log("Listening on port " + port);
  14. });
  15.  
  16. app.get("/", function(request, response){
  17.     var connection = mysql.createConnection({
  18.         connectionLimit: 100,
  19.         host: "humadshah.com",
  20.         user: "public_guests",
  21.         password:"hello",
  22.         database:"my_quotes"
  23.     });
  24.  
  25.     connection.connect(function(error){
  26.         if(error){
  27.             console.log("Couldn't connect :(  " + error);
  28.         } else {
  29.             console.log("Connected successfully~!");
  30.         }    
  31.     });
  32.  
  33.     connection.query("SELECT * FROM Quotes", function(error, rows, fields){
  34.        if (error) {
  35.            console.log("Something went wrong... " + error);
  36.        } else {
  37.           response.send(rows);
  38.        }
  39.     });
  40.  
  41.     connection.end();
  42. });
  43.    
  44. web: node index.js
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top