Skip to content

Instantly share code, notes, and snippets.

@eduardoromero
Last active July 22, 2019 00:52
Show Gist options
  • Save eduardoromero/7860d8a6a056228386382bcd9b6cd024 to your computer and use it in GitHub Desktop.
Save eduardoromero/7860d8a6a056228386382bcd9b6cd024 to your computer and use it in GitHub Desktop.
Setting up express and rethinkdb
const bodyParser = require('body-parser')
const express = require('express')
const Webtask = require('webtask-tools')
const server = express()
server.use(bodyParser.json())
server.use(bodyParser.urlencoded({extended: true}))
// pass RethinkDB around xD
server.use((req, res, next) => {
req.db = require('rethinkdbdash')({
db: 'weshare',
servers: [{host: req.webtaskContext.secrets.RETHINKDB_SERVER, port: 28015}]
})
next()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment