Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var connection = mysql.createConnection({
- host : "localhost",
- user : "root",
- password: ""
- });
- connection.connect();
- connection.query("use northwind");
- extends layout
- block content
- h1= title
- p Welcome to #{title}
- table
- tr
- th CustomerID
- th Company
- each(item in items)
- tr
- td=item.id
- td=item.company
- var express = require('express');
- var router = express.Router();
- var mysql = require('mysql');
- var connection = mysql.createConnection({
- host : "localhost",
- user : "root",
- database: 'northwind',
- password: ""
- });
- /* GET home page.
- router.get('/', function(req, res, next) {
- res.render('index', { title: 'Express' });
- });*/
- /* GET home page. */
- router.get('/', function(req, res) {
- /* exports.index = function(req, res) {
- var connection = mysql.createConnection(conn);
- var query ='SELECT * FROM customers';
- connection.query(query, function(err, rows, fields) {
- if(err) throw err;
- res.render('index', { title: 'North Wind BB', 'items': rows });
- });
- }; */
- var connection = mysql.createConnection(connection);
- var query ='SELECT * FROM customers';
- connection.query(query, function(err, rows, fields)
- {
- if (err)
- {
- console.log(err);
- }
- else{
- res.render('index', { title: 'North Wind BB', 'items': rows });
- console.log(rows);
- }
- });
- });
- module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement