node.js

Is there a configuration option for using Unix domain socket to connect to SQL Server Instance?

折月煮酒 提交于 2021-02-10 12:39:24
问题 I am attempting to link an app engine service to an instance of SQL Server on the Google Cloud Platform using this documentation My service is a nodejs application and I am using the mssql library to connect to my database. The documentation only describes using TCP/IP (an ip address): const pool = new sql.ConnectionPool({ user: '...', password: '...', server: 'localhost', database: '...' }) If I try to use localhost or 127.0.0.1 for my server , the connection fails: I need help with one of

Is there a configuration option for using Unix domain socket to connect to SQL Server Instance?

白昼怎懂夜的黑 提交于 2021-02-10 12:38:25
问题 I am attempting to link an app engine service to an instance of SQL Server on the Google Cloud Platform using this documentation My service is a nodejs application and I am using the mssql library to connect to my database. The documentation only describes using TCP/IP (an ip address): const pool = new sql.ConnectionPool({ user: '...', password: '...', server: 'localhost', database: '...' }) If I try to use localhost or 127.0.0.1 for my server , the connection fails: I need help with one of

Socket.io http://localhost:3000/socket.io/socket.io.js 404 (Not Found) - How to configure socket.IO - nodejs, apache2, websockets

做~自己de王妃 提交于 2021-02-10 12:30:51
问题 Ok im having problems yet again with socket.io and express. When I run my node js application it begins to build before hitting an error " GET http://localhost:3000/socket.io/socket.io.js 404 (Not Found) " and "Uncaught ReferenceError: io is not defined" This is my second time working with web sockets and receiving the same error. For the previous app I fixed this problem by setting up a reverse proxy on my apache server. It looked like this; ProxyPass /socket.io http://localhost:3000/socket

How to test plain Vue components (not single file components)

强颜欢笑 提交于 2021-02-10 12:22:11
问题 All of these tries are throwing an error: var testUtils=require('@vue/test-utils'), Vue=require('vue'); require('jsdom-global')(); testUtils.mount(Vue.component('test', { template:'<div>test</div>' })); testUtils.mount(Vue.component('test', { render:function(el) { return el('div', 'test'); } })); testUtils.mount({ template:'<div>test</div>' }); @vue/test-utils/dist/vue-test-utils.js:2471 var componentInstance = node.child; TypeError: Cannot read property 'child' of undefined I have also tried

SequelizeConnectionError in Node.js application

邮差的信 提交于 2021-02-10 12:22:07
问题 I have strange problem and don't know in what place is the problem. I will be grateful for any help. I have Node.js application which works fine in local windows 10 computer. I run this application successfully in Docker which is in CentOS server. This application works with remote MySQL and PostgreSQL databases. It worked correctly several days but yestoday I notice that I have error. Application can't connect to remote MySQL database anymore. In the same time I can connect to that remote

Why does a Promise return an object Promise, even if I put `return` explicitly? [duplicate]

允我心安 提交于 2021-02-10 12:20:07
问题 This question already has answers here : JS: Promise doesn't return value (2 answers) Closed 1 year ago . I expected a Promise will return a value that I put. But It doesn't return a value but returns Promise { pending } var c = new Promise((resolve, reject)=>{ console.log('here'); return 'return here'; // resolve('resolve here') }); console.log(c); I expected there will be return here instead of Promise { pending } 回答1: Why does a Promise return an object Promise, even if I put return

Why does a Promise return an object Promise, even if I put `return` explicitly? [duplicate]

笑着哭i 提交于 2021-02-10 12:18:07
问题 This question already has answers here : JS: Promise doesn't return value (2 answers) Closed 1 year ago . I expected a Promise will return a value that I put. But It doesn't return a value but returns Promise { pending } var c = new Promise((resolve, reject)=>{ console.log('here'); return 'return here'; // resolve('resolve here') }); console.log(c); I expected there will be return here instead of Promise { pending } 回答1: Why does a Promise return an object Promise, even if I put return

How do I create a prepared statement in Node.JS for MSSQL?

放肆的年华 提交于 2021-02-10 12:16:07
问题 I need to insert a string defined in Javascript into an MSSQL table. This is what I have so far: Javascript: var message = "It's a great day today!"; $.post('www.server.com/message='+message, function(response){ console.log(response); }); Node.js Server: //..... a bunch of code has been used to accept the HTTP request and get the message... // for the purpose of this example, the message is asigned to 'NodeMsg' var mssqldb = require("../core/mssql"); var NodeMsg =

Node.js readline inside of promises

♀尐吖头ヾ 提交于 2021-02-10 12:16:06
问题 I'm trying to use the node.js package readline to get user input on the command line, and I want to pipe the entered input through promises. However, the input never gets through the then chain. I think the problem could come from the fact that the promises are fulfilled in the callback method, but I don't know how to solve that problem. An example of this problem looks like this: import rlp = require('readline'); const rl = rlp.createInterface({ input: process.stdin, output: process.stdout }

Node.js multiple subdomains

China☆狼群 提交于 2021-02-10 12:06:58
问题 I am using node.js to build a multi-tenant application where different clients with their own subdomains will be accessing a single instance of my app. My questions is: Is there a way for the app to find out which subdomain a user is on? That way, I can route the user to the correct database schema (postgresql). Thanks in advance! Additional information: I am using the Express framework I'm not using multiple instances because I expect to have upwards of thousands of users and I don't want to