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.

165 lines
4.3 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. #### RESOURCES using:
  43. initial avatars users: [http://www.flaticon.com/packs/animal-icon-collection](http://www.flaticon.com/packs/animal-icon-collection)
  44. ---
  45. ## API Documentation
  46. This section is not finished.
  47. ### GET /travels
  48. Returns a json array with the page travals.
  49. - Pagination option: **/travels?page=2**
  50. - Each page has a length of 20 travels.
  51. ### GET /travels/id/{travelid}
  52. Returns the full json data of a travel.
  53. ```json
  54. {
  55. "_id": "5b582cc8a920010ebdba5445",
  56. "from": {
  57. "lat": 43.6170137,
  58. "long": 13.5170982,
  59. "name": "Ancona, AN, MAR, Italy"
  60. },
  61. "to": {
  62. "lat": 43.8198253,
  63. "long": 7.7748827,
  64. "name": "Sanremo, IM, Liguria, Italy"
  65. },
  66. "joins": [],
  67. "joinPetitions": [],
  68. "comments": [],
  69. "title": "Visiting Torri Superiori",
  70. "user": {
  71. "_id": "5b3cf604a920010ebdba1111",
  72. "avatar": "https://imgc.artprintimages.com/img/print/janet-muir-cape-washington-antarctica-adelie-penguin-walks-forward_u-l-pyoufg0.jpg",
  73. "validated": false,
  74. "username": "person1",
  75. "telegram": "person1"
  76. },
  77. "date": "2018-08-04T22:00:00.000Z",
  78. "generateddate": "2018-07-25T07:54:48.000Z",
  79. "seats": 2,
  80. "type": "asking",
  81. "__v": 0
  82. }
  83. ```
  84. ### GET /users
  85. - Pagination option: **/users?page=2**
  86. - Each page has a length of 20 users.
  87. ### GET /users/id/{userid}
  88. ```json
  89. {
  90. "_id": "5a83528d7ce0482bab4f4111",
  91. "description": "Hello world",
  92. "avatar": "https://imgc.artprintimages.com/img/print/janet-muir-cape-washington-antarctica-adelie-penguin-walks-forward_u-l-pyoufg0.jpg",
  93. "faircoinString": "faircoin address",
  94. "faircoin": "url/data of QR faircoin address",
  95. "validated": true,
  96. "valorations": [],
  97. "likes": ["5ad4b4f69a32d22cc7848011"],
  98. "favs": [],
  99. "travels": [{
  100. "_id": "5b0a66daab8f07271498a411",
  101. "from": {
  102. "lat": 41.816082,
  103. "long": 2.5138924,
  104. "name": "Arbúcies, Selva, Girona, Catalonia, 17401, Spain"
  105. },
  106. "to": {
  107. "lat": 41.3828939,
  108. "long": 2.1774322,
  109. "name": "Barcelona, BCN, Catalonia, Spain"
  110. },
  111. "title": "Arbúcies-Barcelona",
  112. "date": "2018-05-27T14:00:00.000Z",
  113. "type": "offering"
  114. }, {
  115. "_id": "5b2780f4ab8f07271498a411",
  116. "from": {
  117. "lat": 41.3828939,
  118. "long": 2.1774322,
  119. "name": "Barcelona, BCN, Catalonia, Spain"
  120. },
  121. "to": {
  122. "lat": 41.1172364,
  123. "long": 1.2546057,
  124. "name": "Tarragona, Tarragonès, Tarragona, Catalonia, Spain"
  125. },
  126. "title": "going to Tarragona",
  127. "date": "2018-07-02T08:00:00.000Z",
  128. "type": "asking"
  129. }],
  130. "notifications": [],
  131. "username": "person2",
  132. "telegram": "person2",
  133. "localNode": "Catalunya",
  134. "__v": 4,
  135. "validatedBy": {
  136. "_id": "5a835596c45e042c19d3fb11",
  137. "username": "commonroutesadmin01"
  138. }
  139. }
  140. ```