File: examples/save_cam_captures/node.js/capture.js

Recommend this page to a friend!
  Classes of Juan Chaves   JE5   examples/save_cam_captures/node.js/capture.js   Download  
File: examples/save_cam_captures/node.js/capture.js
Role: Example script
Content type: text/plain
Description: Example script
Class: JE5
jQuery plugin to generate canvas, audio and video
Author: By
Last change: Change data
Add play node example save_cam_captures
Date: 2 years ago
Size: 913 bytes
 

Contents

Class file image Download
var mysql = require('mysql'); var express = require('express'); var path = require('path'); var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(express.static(path.join(__dirname, 'public'))); app.post('/capture', function(req, res) { var connection = mysql.createConnection({ host : 'localhost', user : 'youruser', password : 'yourpass', database : 'yourdb' }); connection.connect(); if(req.body.img != 'data:,' && req.body.img != '') { var rec = ",\""+req.body.img+"\""; var queryString = "UPDATE `streaming` SET `img` = '"+req.body.img+"', `rec` = CONCAT('"+rec+"', `rec`) WHERE ID = 1"; connection.query(queryString, function(err, rows) { if(err) { console.log(err); } else { console.log('Image saved correctly'); } connection.end(); }); } }); console.log('server start'); app.listen(8000);