我可以直接连接到从JavaScript在浏览器中运行的Redis的服务器? [英] Can I connect directly to a Redis server from JavaScript running in a browser?
问题描述
我知道有对Redis的node.js的图书馆;我想要做的(无论是在本地主机或服务器主机上的某个地方)运行Redis的服务器,直接通过HTTP(如AJAX或HTTP GET根据需要)从JavaScript的浏览器中运行调用它(即Greasemonkey的或Chrome扩展脚本,或者一个书签或SCRIPT标签)。 Redis的是否有原生REST或HTTP API?
I know there are node.js libraries for Redis; what I'd like to do is run a Redis server (either on localhost or on a server host somewhere) and call it directly via HTTP (i.e. AJAX or HTTP GET as needed) from JavaScript running inside a browser (i.e. a Greasemonkey or Chrome Extension script, or maybe a bookmarklet or SCRIPT tag). Does Redis have a native REST or HTTP API?
推荐答案
您不能直接从JavaScript在浏览器中运行的连接到Redis的,因为Redis的不说话HTTP。你可以做的是把 webdis 在Redis的面前,它与一个Redis的情况下通过HTTP接口就可以工作。
You can't connect directly to Redis from JavaScript running in a browser because Redis does not speak HTTP. What you can do is put webdis in front of Redis, it makes it possible work with a Redis instance over a HTTP interface.
这篇关于我可以直接连接到从JavaScript在浏览器中运行的Redis的服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!