padArchiver/README.md
README.mdRaw
1# padArchiver
2Tool to store a pad (from the link) into IPFS and Git.
3
4
5
6## padArchiver-APIserver
7This is an API to run in localhost.
8
9#### Run
10To run using the compiled binary:
11- The Git repo needs to be initialized, and with the remote already configured.
12- The IPFS daemon needs to be running:
13```
14> ipfs daemon
15```
16
17- Edit the file config.json to configure the desired port:
18```
19{
20 "port": "3080"
21}
22```
23
24- Execute the API server:
25```
26> ./padArchiver-APIserver
27```
28
29#### API Routes
30
31###### - GET /repos
32this returns:
33```
34[
35 'repo01',
36 'repo02'
37]
38```
39
40
41###### - GET /repos/{repoid}
42this returns:
43```
44[
45 'repo01',
46 'repo01/Group1',
47 'repo01/Group1/Pad1.md',
48 'repo01/Group2',
49 'repo01/Group2/Pad2.md',
50 'repo01/Group2/Pad3.md',
51 'repo02/GroupA/Pad1.md'
52]
53```
54
55
56###### - POST /repos/{repoid}/pad
57data to send:
58```
59json: {
60 "link": "http://board.net/p/pad1",
61 "dir": "Group1",
62 "title": "Pad1"
63}
64```
65this returns:
66```
67{
68 "link": "http://board.net/p/pad1",
69 "dir": "Group1",
70 "title": "Pad1",
71 "ipfsHash": "QmVyp4JSREK5syLmNRCafkZkhzC7CfvS9qYWKfvfffqK2B"
72}
73```
74The IPFS hash is also added to the first line of the document, before adding the document to Git.
75
76## padArchiver-cli
77To run the CLI, just need to run:
78```
79./padArchiver-cli
80```
81And follow the instructions.