| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Decentralized micrologging. A lightweight module to manage mini posts through your node app.
You can use curl to run all the commands below or you can create your own site and use the module as part of your micrologging setup.
Install redis.
> brew install redis > redis-server
npm install
{
id: 1,
fullName: 'Edna Piranha',
postUrl: 'http://url/to/this/meatspace.com/recent.json',
content: {
created: 1368383147,
updated: 1368383147,
message: 'some message',
urls: [
{
title: 'some url',
url: 'http://some.url.com'
}
]
},
meta: {
location: '37.3882807, -122.0828559',
isPrivate: false,
isShared: false
},
shares: [
'http://some.other.url.com/recent.json'
]
}
var Meatspace = require('meatspace');
var meat = new Meatspace({
fullName: 'Edna Piranha',
username: 'ednapiranha',
postUrl: 'http://meatspace.generalgoods.net/recent.json',
db: 0,
limit: 10,
keyId: ':1'
});
db is the Redis database you are using.
keyId is an optional value you can set to assign a key to a particular user id or identifier. If you are not running this for multiple users, skip changing this option (optional).
limit is the number of records you want returned per page - defaults to 10 (optional).
var message = {
content: {
message: 'some message',
urls: [
{
title: 'some url',
url: 'http://some.url.com'
}
]
},
meta: {
location: '37.3882807, -122.0828559',
isPrivate: false
}
};
meat.create(message, function (err, message) {
if (!err) {
console.log(message);
}
});
meat.get(1, function (err, m) {
if (!err) {
m.content.message = 'new updated message';
meat.update(m, function (err, m) {
if (!err) {
console.log(m)
}
});
}
});
meat.get(1, function (err, message) {
if (!err) {
meat.del(message.id, function (err, status) {
if (status) {
console.log('deleted!')
}
});
}
});
The default limit is set to 10. You can change this by setting meat.limit = 15 as an example.
First argument 0 is the starting point from where you want to get messages.
meat.getAll(0, function (err, messages) {
if (!err) {
console.log(messages);
}
});
The default limit is set to 10. You can change this by setting meat.limit = 15 as an example.
First argument 0 is the starting point from where you want to get messages.
meat.shareRecent(0, function (err, messages) {
if (!err) {
console.log(messages);
}
});
meat.shareOne(1, function (err, message) {
if (!err) {
console.log(message);
}
});
Assumptions: externalMessage is a meatspace message from a separate server.
meat.share(externalMessage, meat.postUrl, function (err, message) {
if (!err) {
console.log(message);
}
});
meat.getSubscriptions(function (err, subscriptoins) {
if (!err) {
console.log(subscriptions);
}
});
meat.subscribe('http://some.other.url/recent.json', function (err, url) {
if (!err) {
console.log(url);
}
});
meat.unsubscribe('http://some.other.url/recent.json', function (err, status) {
if (!err) {
console.log(status);
}
});
meat.getSubscriptionRecent('http://some.other.url/recent.json', function (err, messages) {
if (!err) {
console.log(messages);
}
});
meat.flush();
make test
| Back | FazBrowse Home | New Git URL |