Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.index = function (req, res) {
- var query = "SELECT P.pid, P.title, P.tags, P.topic, P.body_preview FROM Posts P ORDER BY P.date_created DESC";
- new req.sql.Request().query(query, function (err, recordset) {
- if (err) throw err;
- res.render('index', {
- rows: recordset
- });
- });
- exports.g_login = function (req, res) {
- res.render('auth/login');
- }
- Express server listening on port \.pipe7a9d4df2-518e-4eb1-afbe-74064c927cbf
- Sat Oct 14 2017 23:17:24 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
- ConnectionError: Connection is closed.
- at D:homesitewwwrootnode_modulesmssqllibmain.js:1569:17
- at nextTickCallbackWith0Args (node.js:420:9)
- at process._tickCallback (node.js:349:13)
- var sql = require("mssql");
- // Setup for Azure SQL Server
- var config = {
- user: env.username,
- password: env.password,
- server: "mydomain.database.windows.net",
- database: "blog",
- // As per the npm docs, encrypt=true for Azure connections
- options: {
- encrypt: true
- }
- };
- sql.connect(config, function (err) {
- if (err) throw err;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement