I hereby claim:
- I am eduardoromero on github.
- I am eromero (https://keybase.io/eromero) on keybase.
- I have a public key ASBnzepAboWcHgMb3dAUskLUKbaIaCBh_qipA1vMB4txpAo
To claim this, I am signing this object:
const Observe = (AnObject, Label = '') => { | |
const name = Label || generateLabel(AnObject) | |
if (DISABLE_TRACING) { | |
return AnObject | |
} | |
return new Proxy(AnObject, { | |
get(target, prop) { | |
let label = '' |
const iopipeLib = require('@iopipe/iopipe') | |
const tracePlugin = require('@iopipe/trace') | |
const iopipe = iopipeLib({ | |
token: process.env.IOPIPE_TOKEN || '', | |
enabled: Boolean(process.env.IOPIPE_TOKEN), | |
plugins: [ | |
tracePlugin({ | |
autoHttp: true | |
}) |
const Observe = (AnObject) => { | |
return new Proxy(AnObject, { | |
get (target, prop) { | |
const method = target[prop] | |
if (typeof method === 'function') { | |
console.log(`\`${method}\` was accessed`) | |
} else { |
I hereby claim:
To claim this, I am signing this object:
server.delete('/:id', (req, res, next) => { | |
const id = req.params.id | |
req.db.table('shares').get(id).delete() | |
.then((response) => { | |
res.status(200).json({ | |
response | |
}) | |
}) | |
.catch(error => res.status(500).send({error})) |
server.post('/', (req, res) => { | |
let data = req.body | |
req.db.table('shares').insert(data, {returnChanges: true}) | |
.then((response) => { | |
data = Array.isArray(req.body) ? response.changes.map(item => item.new_val) : response.changes[0].new_val | |
res.status(200).json({ | |
data: data, | |
response |
server.get('/', (req, res, next) => { | |
let _offset = parseInt(req.query.offset) || 0 | |
let _limit = parseInt(req.query.limit) || 10 | |
// max per page | |
if (_limit > 100) { | |
_limit = 100 | |
} | |
req.db.table('shares').filter({}).skip(_offset).limit(_limit) |
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 |
serverless config credentials --provider webtasks |
npm i | |
sls deploy |