This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.cors = (req, res)-> | |
origin = (req.headers.origin || "*") | |
if req.method.toUpperCase() == 'OPTIONS' | |
res.writeHead 200, | |
'Access-Control-Allow-Origin': origin | |
'Access-Control-Allow-Credentials': true | |
'Access-Control-Allow-Methods': '*' | |
'Access-Control-Allow-Headers': 'Accept, Authorization, Cache-Control, Content-Type, Origin, Referer, User-Agent, X-CSRF-Token' | |
'Content-Type': 'text/plain' | |
'Server': 'jsonapi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
neo4j = require('./caching_client').createClient | |
port: process.env.NEO4J_PORT | |
host: process.env.NEO4J_HOST | |
username : process.env.NEO4J_LOGIN | |
password : process.env.NEO4J_PASSWORD | |
neo4j.runCypher 'START x = node(0) RETURN x', (err, output, res)-> | |
if err | |
console.log err.message | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# npm install mongodb | |
mongodb = require 'mongodb' | |
url = require 'url' | |
log = console.log | |
connection_uri = url.parse(process.env.MONGOHQ_URL) | |
db_name = connection_uri.pathname.replace(/^\//, '') | |
mongodb.Db.connect process.env.MONGOHQ_URL, (error, client)-> | |
throw error if error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install mongodb | |
var mongodb = require('mongodb'); | |
var url = require('url'); | |
var log = console.log; | |
var connectionUri = url.parse(process.env.MONGOHQ_URL); | |
var dbName = connectionUri.pathname.replace(/^\//, ''); | |
mongodb.Db.connect(process.env.MONGOHQ_URL, function(error, client) { | |
if (error) throw error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install mongo bson_ext json | |
require 'rubygems' # if less than Ruby 1.9 | |
require 'mongo' | |
require 'uri' | |
require 'json' | |
def get_connection | |
return @db_connection if @db_connection | |
db = URI.parse(ENV['MONGOHQ_URL']) | |
db_name = db.path.gsub(/^\//, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- PHP Mongo Docs: http://php.net/manual/en/class.mongodb.php --> | |
<html> | |
<body> | |
<h1>MongoHQ Test</h1> | |
<?php | |
try { | |
// connect to MongoHQ assuming your MONGOHQ_URL environment | |
// variable contains the connection string | |
$connection_url = getenv("MONGOHQ_URL"); |
NewerOlder