You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
4.7 KiB

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