1234567891011121314151617181920212223242526272829303132333435 |
- var express = require('express');
- var app = express();
-
- var mysql = require('mysql');
- var bodyParser = require('body-parser');
-
- app.use(bodyParser.json({type:'application/json'}));
- app.use(bodyParser.urlencoded({extended:true}));
-
- var con = mysql.createConnectionI({
- host:'ada.uprrp.edu',
- user: 'pablo.puig1',
- password: '9NA3kSExI2fGE6eV',
- database: 'techos'
-
- });
-
- var server = app.listen(4545, function(){
- var host = server.address().address
- var host = server.address().port
- });
-
- con.connect(function(error){
- if(error) console.log(error);
- else console.log('connected');
- })
-
- app.get('/users', function(req, res){
- con.query('SELECT * FROM users', function(error, rows, fields){
- if(error) console.log(error)
- else{
- console.log(rows);
- }
- })
- })
|