Skip to content

Instantly share code, notes, and snippets.

View devesh2605's full-sized avatar

Devesh Vyas devesh2605

  • Intel Corporation
  • Bangalore, India
View GitHub Profile
var express = require('express'),
app = express(),
cors = require('cors'),
helmet = require('helmet'),
mysql = require('mysql'),
bodyParser = require('body-parser'),
crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'zyxcba',
port = 3000;
@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@clarle
clarle / app.js
Created July 26, 2012 07:35
Short tutorial on how to use Express and node-mysql
// Module dependencies
var express = require('express'),
mysql = require('mysql');
// Application initialization
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',