commonroutesServer/README.md
README.mdRaw
1# commonroutesServer
2
3- Current status:
4 - Server and App almost done, need to finish details.
5 - I'm focusing on having a first stable and usable version
6 - The plan is to have the first stable version in the middle of February 2018
7- Comments:
8 - the code is not a good quality code, as:
9 - it was developed in a discontinued way
10 - in the process I learned stuff that I didn't know at the beginning
11- Future plans:
12 - If somebody can do the frontend, maybe we can implement the frontend app in React
13 - I can focus on implementing the backend in Go lang
14
15---
16
17- server code: https://github.com/arnaucube/commonroutesServer
18- frontend app code: https://github.com/arnaucube/commonroutesApp
19- frontend webapp code: https://github.com/arnaucube/commonroutesWebApp
20- images server: https://github.com/arnaucube/goImgServer
21- admin web: https://github.com/arnaucube/commonroutesAdminWeb
22- landing page: https://github.com/arnaucube/commonroutesLandingPage
23- telegram bot: https://github.com/arnaucube/commonroutesBot
24
25**Backend:**
26
27- Nodejs + Express + MongoDB
28- Go --> for the images server
29
30**Frontend:**
31
32- Angularjs + Ionic
33
34
35
36App:
37
38
39code: https://github.com/arnaucube/commonroutesApp
40
41---
42
43
44**To Do Backend and Frontend:**
45```
46- pagination search
47- https (tls/ssl)
48```
49
50### Configuration before run:
51In controllers/userController.js, define the port of the goImgServer:
52```
53function postImage(req, res, filename, fileImg) {
54 url = "http://127.0.0.1:3001/image";
55 [...]
56```
57
58#### RESOURCES using:
59
60initial avatars users: [http://www.flaticon.com/packs/animal-icon-collection](http://www.flaticon.com/packs/animal-icon-collection)
61
62
63---
64
65## API Documentation
66This section is not finished.
67
68### GET /travels
69Returns a json array with the page travals.
70- Pagination option: **/travels?page=2**
71 - Each page has a length of 20 travels.
72
73### GET /travels/id/{travelid}
74Returns the full json data of a travel.
75```json
76{
77 "_id": "5b582cc8a920010ebdba5445",
78 "from": {
79 "lat": 43.6170137,
80 "long": 13.5170982,
81 "name": "Ancona, AN, MAR, Italy"
82 },
83 "to": {
84 "lat": 43.8198253,
85 "long": 7.7748827,
86 "name": "Sanremo, IM, Liguria, Italy"
87 },
88 "joins": [],
89 "joinPetitions": [],
90 "comments": [],
91 "title": "Visiting Torri Superiori",
92 "user": {
93 "_id": "5b3cf604a920010ebdba1111",
94 "avatar": "https://imgc.artprintimages.com/img/print/janet-muir-cape-washington-antarctica-adelie-penguin-walks-forward_u-l-pyoufg0.jpg",
95 "validated": false,
96 "username": "person1",
97 "telegram": "person1"
98 },
99 "date": "2018-08-04T22:00:00.000Z",
100 "generateddate": "2018-07-25T07:54:48.000Z",
101 "seats": 2,
102 "type": "asking",
103 "__v": 0
104}
105```
106### GET /users
107
108- Pagination option: **/users?page=2**
109 - Each page has a length of 20 users.
110
111### GET /users/id/{userid}
112
113```json
114{
115 "_id": "5a83528d7ce0482bab4f4111",
116 "description": "Hello world",
117 "avatar": "https://imgc.artprintimages.com/img/print/janet-muir-cape-washington-antarctica-adelie-penguin-walks-forward_u-l-pyoufg0.jpg",
118 "faircoinString": "faircoin address",
119 "faircoin": "url/data of QR faircoin address",
120 "validated": true,
121 "valorations": [],
122 "likes": ["5ad4b4f69a32d22cc7848011"],
123 "favs": [],
124 "travels": [{
125 "_id": "5b0a66daab8f07271498a411",
126 "from": {
127 "lat": 41.816082,
128 "long": 2.5138924,
129 "name": "Arbúcies, Selva, Girona, Catalonia, 17401, Spain"
130 },
131 "to": {
132 "lat": 41.3828939,
133 "long": 2.1774322,
134 "name": "Barcelona, BCN, Catalonia, Spain"
135 },
136 "title": "Arbúcies-Barcelona",
137 "date": "2018-05-27T14:00:00.000Z",
138 "type": "offering"
139 }, {
140 "_id": "5b2780f4ab8f07271498a411",
141 "from": {
142 "lat": 41.3828939,
143 "long": 2.1774322,
144 "name": "Barcelona, BCN, Catalonia, Spain"
145 },
146 "to": {
147 "lat": 41.1172364,
148 "long": 1.2546057,
149 "name": "Tarragona, Tarragonès, Tarragona, Catalonia, Spain"
150 },
151 "title": "going to Tarragona",
152 "date": "2018-07-02T08:00:00.000Z",
153 "type": "asking"
154 }],
155 "notifications": [],
156 "username": "person2",
157 "telegram": "person2",
158 "localNode": "Catalunya",
159 "__v": 4,
160 "validatedBy": {
161 "_id": "5a835596c45e042c19d3fb11",
162 "username": "commonroutesadmin01"
163 }
164}
165```