mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* updated definitions * fixes duplicated names * add allow synthetic def imports, add ts version * bump module version * little test fixes * removed ts version * fix module name and link to github, revert tsconfig * fix of tsconfig(2) * add fake interface for express-myconnection * lint config and fixes, typeCasting, interface renaming * fix naming, fix express-myconnection * node-mysql-wrapper fix
39 lines
832 B
TypeScript
39 lines
832 B
TypeScript
|
|
|
|
import express = require('express');
|
|
import mysql = require('mysql');
|
|
import connection = require('express-myconnection');
|
|
|
|
var app = express();
|
|
|
|
app.use(
|
|
connection(
|
|
mysql,
|
|
{
|
|
host: 'localhost',
|
|
user: 'dbuser',
|
|
password: 'password',
|
|
port: 3306,
|
|
database: 'mydb'
|
|
},
|
|
'single'
|
|
)
|
|
);
|
|
|
|
|
|
app.use(function list(req: express.Request, res: express.Response, next: Function){
|
|
|
|
req.getConnection(function(err: mysql.MysqlError, connection: mysql.Connection) {
|
|
if (err) return next(err);
|
|
|
|
connection.query('SELECT 1 AS RESULT', [], function(err: mysql.MysqlError, results: any) {
|
|
if (err) return next(err);
|
|
|
|
results[0].RESULT;
|
|
// -> 1
|
|
|
|
res.send(200);
|
|
});
|
|
});
|
|
});
|