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