From 8300fa0d0acaf16743005c33551771693fd06976 Mon Sep 17 00:00:00 2001 From: Ben West Date: Sun, 13 Jul 2014 20:46:54 -0700 Subject: [PATCH] some very simple helper scripts to work with the api --- bin/create_svg.sh | 23 ++++++++++++++ bin/tsvtojson.sh | 15 ++++++++++ lib/api.js | 76 ++++++++++++++++++++++++++++++++++++++++++++++- package.json | 3 +- 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100755 bin/create_svg.sh create mode 100755 bin/tsvtojson.sh diff --git a/bin/create_svg.sh b/bin/create_svg.sh new file mode 100755 index 00000000..3fbb8fe8 --- /dev/null +++ b/bin/create_svg.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +SVG=$1 +DIRECTION=$2 +AT=$3 +OPTS="" +if [ -n "$AT" ]; then + OPTS="--date ${AT}" +fi +ISO=$(date -Iseconds $OPTS) +UNIX=$(date +%s $OPTS) + +( +cat <STATUS OK"); + }, + png: function ( ) { + res.redirect(302, badge + '.png'); + }, + svg: function ( ) { + res.redirect(302, badge + '.svg'); + }, + text: function ( ) { + res.send("STATUS OK"); + }, + */ + json: function ( ) { + res.json(result); + } + }); + }) // ; + ); + return; + }); + api.get('/entries/:id', function(req, res) { console.log('body', req.body); console.log('params', req.params); diff --git a/package.json b/package.json index eb1fd9d9..0d6c7283 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "express": "^4.5.1", "mongodb": "^1.4.7", "socket.io": "^0.9.17", - "express-extension-to-accept": "0.0.2" + "express-extension-to-accept": "0.0.2", + "event-stream": "~3.1.5" } }