products.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. var data = [
  2. {
  3. "id":"1",
  4. "price":"71.72",
  5. "company":"3m Co",
  6. "date":"2007-09-01",
  7. "size":"large",
  8. "visible":"1"
  9. },
  10. {
  11. "id":"2",
  12. "price":"31.61",
  13. "company":"AT&T Inc.",
  14. "date":"2008-02-01",
  15. "size":"extra large",
  16. "visible":"0"
  17. },
  18. {
  19. "id":"3",
  20. "price":"29.01",
  21. "company":"Aloca Inc",
  22. "date":"2007-08-01",
  23. "size":"medium",
  24. "visible":"0"
  25. },
  26. {
  27. "id":"4",
  28. "price":"83.81",
  29. "company":"Altria Group Inc",
  30. "date":"2007-08-03",
  31. "size":"large",
  32. "visible":"0"
  33. },
  34. {
  35. "id":"5",
  36. "price":"52.55",
  37. "company":"American Express Company",
  38. "date":"2008-01-04",
  39. "size":"extra large",
  40. "visible":"1"
  41. },
  42. {
  43. "id":"6",
  44. "price":"64.13",
  45. "company":"American International Group Inc.",
  46. "date":"2008-03-04",
  47. "size":"small",
  48. "visible":"1"
  49. },
  50. {
  51. "id":"7",
  52. "price":"75.43",
  53. "company":"Boeing Co.",
  54. "date":"2008-01-01",
  55. "size":"large",
  56. "visible":"1"
  57. },
  58. {
  59. "id":"8",
  60. "price":"67.27",
  61. "company":"Caterpillar Inc.",
  62. "date":"2007-12-03",
  63. "size":"medium",
  64. "visible":"1"
  65. },
  66. {
  67. "id":"9",
  68. "price":"49.37",
  69. "company":"Citigroup, Inc.",
  70. "date":"2007-11-24",
  71. "size":"large",
  72. "visible":"1"
  73. },
  74. {
  75. "id":"10",
  76. "price":"40.48",
  77. "company":"E.I. du Pont de Nemours and Company",
  78. "date":"2007-05-09",
  79. "size":"extra large",
  80. "visible":"0"
  81. },
  82. {
  83. "id":"11",
  84. "price":"68.1",
  85. "company":"Exxon Mobile Corp",
  86. "date":"2007-12-12",
  87. "size":"large",
  88. "visible":"1"
  89. },
  90. {
  91. "id":"12",
  92. "price":"34.14",
  93. "company":"General Electric Company",
  94. "date":"2008-06-16",
  95. "size":"extra large",
  96. "visible":"1"
  97. },
  98. {
  99. "id":"13",
  100. "price":"30.27",
  101. "company":"General Motors Corporation",
  102. "date":"2006-12-07",
  103. "size":"medium",
  104. "visible":"1"
  105. },
  106. {
  107. "id":"14",
  108. "price":"36.53",
  109. "company":"Hewlett-Packard Co.",
  110. "date":"2007-05-13",
  111. "size":"large",
  112. "visible":"1"
  113. },
  114. {
  115. "id":"15",
  116. "price":"38.77",
  117. "company":"Honweywell Intl Inc",
  118. "date":"2006-11-07",
  119. "size":"medium",
  120. "visible":"0"
  121. },
  122. {
  123. "id":"16",
  124. "price":"19.88",
  125. "company":"Intel Corporation",
  126. "date":"2007-01-09",
  127. "size":"small",
  128. "visible":"1"
  129. },
  130. {
  131. "id":"17",
  132. "price":"81.41",
  133. "company":"International Business Machines",
  134. "date":"2005-01-21",
  135. "size":"extra large",
  136. "visible":"1"
  137. },
  138. {
  139. "id":"18",
  140. "price":"64.72",
  141. "company":"Johnson & Johnson",
  142. "date":"2008-01-10",
  143. "size":"extra large",
  144. "visible":"1"
  145. },
  146. {
  147. "id":"19",
  148. "price":"45.73",
  149. "company":"JP Morgan & Chase & Co",
  150. "date":"2008-02-20",
  151. "size":"large",
  152. "visible":"0"
  153. },
  154. {
  155. "id":"20",
  156. "price":"36.76",
  157. "company":"McDonald's Corporation",
  158. "date":"2007-06-12",
  159. "size":"large",
  160. "visible":"1"
  161. },
  162. {
  163. "id":"21",
  164. "price":"27.96",
  165. "company":"Pfizer Inc",
  166. "date":"2007-12-30",
  167. "size":"small",
  168. "visible":"0"
  169. },
  170. {
  171. "id":"22",
  172. "price":"45.07",
  173. "company":"The Coca-Cola Company",
  174. "date":"2007-01-30",
  175. "size":"medium",
  176. "visible":"0"
  177. },
  178. {
  179. "id":"23",
  180. "price":"34.64",
  181. "company":"The Home Depot, Inc",
  182. "date":"2006-12-31",
  183. "size":"small",
  184. "visible":"1"
  185. },
  186. {
  187. "id":"24",
  188. "price":"61.91",
  189. "company":"The Procter & Gamble Company",
  190. "date":"2007-04-08",
  191. "size":"extra large",
  192. "visible":"1"
  193. },
  194. {
  195. "id":"25",
  196. "price":"63.26",
  197. "company":"United Technologies Corporation",
  198. "date":"2006-06-04",
  199. "size":"medium",
  200. "visible":"1"
  201. },
  202. {
  203. "id":"26",
  204. "price":"35.57",
  205. "company":"Verizon Communications",
  206. "date":"2005-07-09",
  207. "size":"small",
  208. "visible":"0"
  209. },
  210. {
  211. "id":"27",
  212. "price":"45.45",
  213. "company":"Wal-Mart Stores, Inc",
  214. "date":"2006-09-09",
  215. "size":"large",
  216. "visible":"1"
  217. }
  218. ];
  219. module.exports = function(request, response){
  220. var query = request.query;
  221. var page = query.page || 1;
  222. var start = query.start || 0;
  223. var limit = query.limit || 0;
  224. var result = {
  225. total: data.length
  226. };
  227. if(limit > 0) {
  228. result.list = data.slice(start, start + limit);
  229. }else {
  230. result.list = data;
  231. }
  232. return result;
  233. }