Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require('express');
- var app = express();
- app.get('/', function (req, res) {
- var mysql = require('mysql');
- var con = mysql.createConnection({
- host: "",
- user: "",
- password: "",
- database: ""
- });
- con.connect(function(err) {
- if (err) throw err;
- //Select all customers and return the result object:
- con.query("SELECT * FROM table", function (err, result, fields) {
- if (err) throw err;
- console.log(result);
- });
- });
- res.send('Hello World!');
- });
- app.listen(3000, function () {
- console.log('Example app listening on port 3000!');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement