Updated the server + documentation to reflect the format of #4

This commit is contained in:
Jan Schütze 2016-04-04 10:24:10 +02:00
parent 45611f047c
commit 598d050722
2 changed files with 12 additions and 12 deletions

View File

@ -35,39 +35,39 @@ See latest tweets in the Registry (e.g. <https://registry.twtxt.org/api/plain/tw
``` console
$ curl 'http://localhost:8080/api/plain/tweets'
@<dracoblue https://dracoblue.net/twtxt.txt> 2016-02-06T21:32:02.000Z @erlehmann is messing with timestamps in @buckket #twtxt :)
@<dracoblue https://dracoblue.net/twtxt.txt> 2016-02-06T12:14:18.000Z Simple nodejs script to convert your twitter timeline to twtxt: https://t.co/txnWsC5jvA ( find my #twtxt at https://t.co/uN1KDXwJ8B )
dracoblue https://dracoblue.net/twtxt.txt 2016-02-06T21:32:02.000Z @erlehmann is messing with timestamps in @buckket #twtxt :)
dracoblue https://dracoblue.net/twtxt.txt 2016-02-06T12:14:18.000Z Simple nodejs script to convert your twitter timeline to twtxt: https://t.co/txnWsC5jvA ( find my #twtxt at https://t.co/uN1KDXwJ8B )
```
Search for tweets in the Registry (e.g. <https://registry.twtxt.org/api/plain/tweets?q=twtxt>):
``` console
$ curl 'http://localhost:8080/api/plain/tweets?q=twtxt'
@<buckket https://buckket.org/twtxt.txt> 2016-02-09T12:42:26.000Z Do we need an IRC channel for twtxt?
@<buckket https://buckket.org/twtxt.txt> 2016-02-09T12:42:12.000Z Good Morning, twtxt-world!
buckket https://buckket.org/twtxt.txt 2016-02-09T12:42:26.000Z Do we need an IRC channel for twtxt?
buckket https://buckket.org/twtxt.txt 2016-02-09T12:42:12.000Z Good Morning, twtxt-world!
```
Retrieve a list of all mentions of a specific twtxt User like `https://buckket.org/twtxt.txt` (e.g. <https://registry.twtxt.org/api/plain/mentions?url=https://buckket.org/twtxt.txt>):
``` console
$ curl 'http://localhost:8080/api/plain/mentions?url=https://buckket.org/twtxt.txt'
@<dracoblue https://dracoblue.net/twtxt.txt> 2016-02-09T12:57:59.000Z @<buckket https://buckket.org/twtxt.txt> something like https://gitter.im/ or a freenode channel?
@<dracoblue https://dracoblue.net/twtxt.txt> 2016-02-08T22:51:47.000Z @<buckket https://buckket.org/twtxt.txt> looks nice ;)
dracoblue https://dracoblue.net/twtxt.txt 2016-02-09T12:57:59.000Z @<buckket https://buckket.org/twtxt.txt> something like https://gitter.im/ or a freenode channel?
dracoblue https://dracoblue.net/twtxt.txt 2016-02-08T22:51:47.000Z @<buckket https://buckket.org/twtxt.txt> looks nice ;)
```
Retrieve a list of all tweets with a specific tag like `#twtxt` (e.g. <https://registry.twtxt.org/api/plain/tags/twtxt>):
``` console
$ curl 'http://localhost:8080/api/plain/tags/twtxt'
@<dracoblue https://dracoblue.net/twtxt.txt> 2016-02-06T21:32:02.000Z @erlehmann is messing with timestamps in @buckket #twtxt :)
@<dracoblue https://dracoblue.net/twtxt.txt> 2016-02-06T12:14:18.000Z Simple nodejs script to convert your twitter timeline to twtxt: https://t.co/txnWsC5jvA ( find my #twtxt at https://t.co/uN1KDXwJ8B )
dracoblue https://dracoblue.net/twtxt.txt> 2016-02-06T21:32:02.000Z @erlehmann is messing with timestamps in @buckket #twtxt :)
dracoblue https://dracoblue.net/twtxt.txt> 2016-02-06T12:14:18.000Z Simple nodejs script to convert your twitter timeline to twtxt: https://t.co/txnWsC5jvA ( find my #twtxt at https://t.co/uN1KDXwJ8B )
```
Search for users in the Registry (e.g. <https://registry.twtxt.org/api/plain/users?q=dracoblue>):
``` console
$ curl 'http://localhost:8080/api/plain/users?q=dracoblue'
<@dracoblue https://dracoblue.net/twtxt.txt> 2016-02-09T12:42:26.000Z dracoblue
https://dracoblue.net/twtxt.txt 2016-02-09T12:42:26.000Z dracoblue
```
## License

View File

@ -5,10 +5,10 @@ var plainApi = function(storage) {
var renderAuthorForTweet = function(tweet) {
if (tweet.author_nickname) {
return '@<' + tweet.author_nickname + ' ' + tweet.author_url + '>';
return tweet.author_nickname + "\t" + tweet.author_url;
}
return '@<' + tweet.author_url + '>';
return tweet.author_url + "\t" + tweet.author_url;
};
api.use(function (req, res, next) {
@ -100,7 +100,7 @@ var plainApi = function(storage) {
var response = [];
users.forEach(function (user) {
response.push(user.url + "\t" + user.timestamp + "\t" + user.nickname);
response.push(user.nickname + "\t" + user.url + "\t" + user.timestamp);
});
res.send(response.join("\n"));
})