Tag: vuejs2

将数据从Node传递给Vuejs

我有一个本地Node.js服务器运行在端口3000.我有另一个前端使用webpack,在8080上运行的开发服务器。节点连接到MySQL服务器。 我的项目结构如下所示: SampleProject -> BackEnd -> FrontEnd 我已经使用webpack-dev-server代理选项将来自webpack-dev-server(8080)的请求代理到节点(3000)。 开发服务器configuration我的webpack.config.js看起来像这样: – devServer: { proxy: { '/api': { target: 'http://localhost:3000' } }, historyApiFallback: true, noInfo: true } 我在services.js中写了一个Node api exports.getAllPatientData = function(req, res) { con.connection.query("SELECT fname, lname, city, country_code, TIMESTAMPDIFF(YEAR, DOB, CURDATE()) AS age FROM sbds_patient_data where pid = 1", function(err, result, fields) { if (err) { […]

node.js和chrome浏览器之间console.log的奇数输出

我正在玩节点的crypt() ,只是想要确认Diffie-Hillman在节点('Alice')和Chrome客户端('Bob')之间共享的秘密是匹配的。 我把socket.io上的公共密钥发送给对方,并且在他们各自的控制台输出中使用base64编码正确输出,但是当我输出共享密钥时,节点的控制台显示正确,但是Chrome的控制台给了我一串数字。 有什么想法吗? 节点的代码: var Alice = crypto.getDiffieHellman(group); Alice.generateKeys('base64'); console.log("receiving Bob's public key from browser"); var BobsPublicKey = message.data; console.log(BobsPublicKey); console.log("sending Alice's public key to browser"); var AlicesPublicKey = Alice.getPublicKey('base64'); console.log(AlicesPublicKey); client.emit('message', AlicesPublicKey); // compute shared secret var AlicesSharedSecret = Alice.computeSecret(BobsPublicKey, 'base64', 'base64'); console.log("Alice's shared secret:"); console.log(AlicesSharedSecret); 节点的控制台输出(为简洁起见,缩写): receiving Bob's public key from browser […]

Vue资源无法加载快速静态文件

所以,我有一个问题。 这是我的server.js require('dotenv').load(); const http = require('http'); const path = require('path'); const express = require('express'); const app = express(); const server = http.createServer(app).listen(8080, () => { console.log('Foliage started on port 8080'); }); app.use(express.static(path.join(__dirname, '/public'))); app.get('/', (req, res) => { res.sendFile(path.join(__dirname, 'index.html')); }); app.get('*', (req, res) => { res.sendFile(path.join(__dirname, 'index.html')); }); 这是什么,是每一个/whatever它给了index.html文件。 除此之外,它还提供来自/public静态文件现在,我的index.html如下所示: <!DOCTYPE html> <html> […]

VueJS:自定义Socket.io发出触发时没有得到处理

我正在按照vue-socket.io npm下载页面上的说明进行操作。 但是,我不能得到this.$socket.emit方法来工作。 我有这个在我的Main.vue组件: sockets: { connect() { console.log('socket connected') }, getAllOnline(token) { console.log(`Your token is ${token}`) } }, created() { this.$socket.emit('getAllOnline', '123213') } 我在我的main.js文件中设置了VueSocketio ,如下所示: import VueSocketio from 'vue-socket.io'; Vue.use(VueSocketio, 'http://localhost:8080/'); 我期待logging任何传递给getAllOnline()函数的值。 但是只有sockets对象中的connect()callback被触发。 为什么不触发getAllOnline的callback? 完整的main.js文件: // require some files require('./assets/css/reset.css') require('./assets/css/common.css') // The Vue build version to load with the `import` command // (runtime-only […]

如何使用Azure ADvalidationVueJS应用程序?

我正在使用VueJS 2.x框架设置应用程序,并需要通过Azure Active Directory服务对用户进行身份validation。 我已经有了“login信息”(Auth和Token URLs)这个服务。 到目前为止,我只遇到一篇文章 ,显示VueJS中的设置,但它依赖于第三方服务(Auth0) – 在此过程中增加了不必要的卷积。 当没有任何VueJS npm模块可以轻松进行身份validation时,如何继续? 还是必须依赖Adal JS之类的Vue之外的图书馆? 任何的意见都将会有帮助。

如何将一个vuejs项目部署到heroku

我正在这个项目在本地https://github.com/misterGF/CoPilot工作,但现在,它已经完成,我想推它到heroku。 问题是告诉heroku启动应用程序。 在heroku示例中,演示服务器在从Procfile包含此数据的信息后运行 web: node index.js 但在我的vuejs项目中,没有index.js服务器的内容。 我只有主要的入口点是index.html和procfile不适用于HTML。