#Tumblr-Redis
Use tumblr as a CMS.
Fetch post data to store in Redis
Building of of rad-redis
- Run a server
- Merge routes into existing server
##Bonus
Run a cron job to hit tumblr to do all the saving.
The API:
cron/crons.js
The example:
example/cron_example.js
const fs = require('fs')
const cron = require('../cron/cron')
const Cron = cron(
//redisOptions
{ project: 'tumblr' }
,
//tumblrOptions
{
baseUrl: 'https://api.tumblr.com/v2/blog/',
account: 'a3dddog',
apiKey: '<get yours :)>'
})
Cron.start()
Data is saved with the HSET command where the key is formed like:
`${project}:${account}:posts`
and the field is the post type (text, photo, video) ,Tumblr's types
Create a client with chewb-redis or a server-client with this repo:
node bin/api_server.js
^^^Starts a server.js
Retreive data by:
const xhr = require('xhr-request')
const Q = require('bluebird')
const R = Q.promisify(xhr);
function get() {
return R("http://127.0.0.1:6380/hget", {
method: 'POST',
json: true,
body: {
key: 'tumblr:a3dddog:posts'
}
})
}
//returns
{
text:[],
photo:[],
video:[]
}
###Ideas of organisation
Use of tags as ways of organisaing a front end structure.
Using this on ADd.dog
