Skip to content

Instantly share code, notes, and snippets.

@ryanhs
Created November 9, 2018 10:38
Show Gist options
  • Save ryanhs/f1cb83254efaebc6abdf83409ec195ea to your computer and use it in GitHub Desktop.
Save ryanhs/f1cb83254efaebc6abdf83409ec195ea to your computer and use it in GitHub Desktop.
mssql from node
const sql = require('mssql')
const connstring = "mssql://wadezig:[email protected]/dbnamehere?encrypt=true"
const test = async function (context, req) {
let pool = await sql.connect(connstring)
let result = await pool.request()
.input('from', sql.VarChar(255), 'fromval')
.input('to', sql.VarChar(255), 'toval')
.query('insert into referrer (url_from, url_to) values (@from, @to)')
return result;
}
test().then(console.log).catch(console.error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment