홍지윤

Update project directory

search 기능 구현
...@@ -5,6 +5,7 @@ var methodOverride = require('method-override'); ...@@ -5,6 +5,7 @@ var methodOverride = require('method-override');
5 var flash = require('connect-flash'); 5 var flash = require('connect-flash');
6 var session = require('express-session'); 6 var session = require('express-session');
7 var passport = require('./config/passport'); 7 var passport = require('./config/passport');
8 +var multer = require('multer');
8 //require('./config/passport'); 9 //require('./config/passport');
9 10
10 var app = express(); 11 var app = express();
......
1 { 1 {
2 "name": "Project-Mapmory", 2 "name": "Project-Mapmory",
3 "version": "1.0.0", 3 "version": "1.0.0",
4 - "lockfileVersion": 2, 4 + "lockfileVersion": 1,
5 "requires": true, 5 "requires": true,
6 - "packages": {
7 - "": {
8 - "name": "Project-Mapmory",
9 - "version": "1.0.0",
10 - "license": "ISC",
11 - "dependencies": {
12 - "bcryptjs": "^2.4.3",
13 - "body-parser": "^1.19.0",
14 - "connect-flash": "^0.1.1",
15 - "ejs": "^3.1.6",
16 - "express": "^4.17.1",
17 - "express-session": "^1.17.1",
18 - "method-override": "^3.0.0",
19 - "mongoose": "^5.12.8",
20 - "passport": "^0.4.1",
21 - "passport-local": "^1.0.0"
22 - }
23 - },
24 - "node_modules/@types/bson": {
25 - "version": "4.0.3",
26 - "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.3.tgz",
27 - "integrity": "sha512-mVRvYnTOZJz3ccpxhr3wgxVmSeiYinW+zlzQz3SXWaJmD1DuL05Jeq7nKw3SnbKmbleW5qrLG5vdyWe/A9sXhw==",
28 - "dependencies": {
29 - "@types/node": "*"
30 - }
31 - },
32 - "node_modules/@types/mongodb": {
33 - "version": "3.6.12",
34 - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.12.tgz",
35 - "integrity": "sha512-49aEzQD5VdHPxyd5dRyQdqEveAg9LanwrH8RQipnMuulwzKmODXIZRp0umtxi1eBUfEusRkoy8AVOMr+kVuFog==",
36 - "dependencies": {
37 - "@types/bson": "*",
38 - "@types/node": "*"
39 - }
40 - },
41 - "node_modules/@types/node": {
42 - "version": "15.0.2",
43 - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.2.tgz",
44 - "integrity": "sha512-p68+a+KoxpoB47015IeYZYRrdqMUcpbK8re/zpFB8Ld46LHC1lPEbp3EXgkEhAYEcPvjJF6ZO+869SQ0aH1dcA=="
45 - },
46 - "node_modules/accepts": {
47 - "version": "1.3.7",
48 - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
49 - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
50 - "dependencies": {
51 - "mime-types": "~2.1.24",
52 - "negotiator": "0.6.2"
53 - },
54 - "engines": {
55 - "node": ">= 0.6"
56 - }
57 - },
58 - "node_modules/ansi-styles": {
59 - "version": "3.2.1",
60 - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
61 - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
62 - "dependencies": {
63 - "color-convert": "^1.9.0"
64 - },
65 - "engines": {
66 - "node": ">=4"
67 - }
68 - },
69 - "node_modules/array-flatten": {
70 - "version": "1.1.1",
71 - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
72 - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
73 - },
74 - "node_modules/async": {
75 - "version": "0.9.2",
76 - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
77 - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
78 - },
79 - "node_modules/balanced-match": {
80 - "version": "1.0.2",
81 - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
82 - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
83 - },
84 - "node_modules/bcryptjs": {
85 - "version": "2.4.3",
86 - "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
87 - "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms="
88 - },
89 - "node_modules/bl": {
90 - "version": "2.2.1",
91 - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz",
92 - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==",
93 - "dependencies": {
94 - "readable-stream": "^2.3.5",
95 - "safe-buffer": "^5.1.1"
96 - }
97 - },
98 - "node_modules/bluebird": {
99 - "version": "3.5.1",
100 - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
101 - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
102 - },
103 - "node_modules/body-parser": {
104 - "version": "1.19.0",
105 - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
106 - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
107 - "dependencies": {
108 - "bytes": "3.1.0",
109 - "content-type": "~1.0.4",
110 - "debug": "2.6.9",
111 - "depd": "~1.1.2",
112 - "http-errors": "1.7.2",
113 - "iconv-lite": "0.4.24",
114 - "on-finished": "~2.3.0",
115 - "qs": "6.7.0",
116 - "raw-body": "2.4.0",
117 - "type-is": "~1.6.17"
118 - },
119 - "engines": {
120 - "node": ">= 0.8"
121 - }
122 - },
123 - "node_modules/brace-expansion": {
124 - "version": "1.1.11",
125 - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
126 - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
127 - "dependencies": {
128 - "balanced-match": "^1.0.0",
129 - "concat-map": "0.0.1"
130 - }
131 - },
132 - "node_modules/bson": {
133 - "version": "1.1.6",
134 - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz",
135 - "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==",
136 - "engines": {
137 - "node": ">=0.6.19"
138 - }
139 - },
140 - "node_modules/bytes": {
141 - "version": "3.1.0",
142 - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
143 - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
144 - "engines": {
145 - "node": ">= 0.8"
146 - }
147 - },
148 - "node_modules/chalk": {
149 - "version": "2.4.2",
150 - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
151 - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
152 - "dependencies": {
153 - "ansi-styles": "^3.2.1",
154 - "escape-string-regexp": "^1.0.5",
155 - "supports-color": "^5.3.0"
156 - },
157 - "engines": {
158 - "node": ">=4"
159 - }
160 - },
161 - "node_modules/color-convert": {
162 - "version": "1.9.3",
163 - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
164 - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
165 - "dependencies": {
166 - "color-name": "1.1.3"
167 - }
168 - },
169 - "node_modules/color-name": {
170 - "version": "1.1.3",
171 - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
172 - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
173 - },
174 - "node_modules/concat-map": {
175 - "version": "0.0.1",
176 - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
177 - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
178 - },
179 - "node_modules/connect-flash": {
180 - "version": "0.1.1",
181 - "resolved": "https://registry.npmjs.org/connect-flash/-/connect-flash-0.1.1.tgz",
182 - "integrity": "sha1-2GMPJtlaf4UfmVax6MxnMvO2qjA=",
183 - "engines": {
184 - "node": ">= 0.4.0"
185 - }
186 - },
187 - "node_modules/content-disposition": {
188 - "version": "0.5.3",
189 - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
190 - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
191 - "dependencies": {
192 - "safe-buffer": "5.1.2"
193 - },
194 - "engines": {
195 - "node": ">= 0.6"
196 - }
197 - },
198 - "node_modules/content-type": {
199 - "version": "1.0.4",
200 - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
201 - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
202 - "engines": {
203 - "node": ">= 0.6"
204 - }
205 - },
206 - "node_modules/cookie": {
207 - "version": "0.4.0",
208 - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
209 - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==",
210 - "engines": {
211 - "node": ">= 0.6"
212 - }
213 - },
214 - "node_modules/cookie-signature": {
215 - "version": "1.0.6",
216 - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
217 - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
218 - },
219 - "node_modules/core-util-is": {
220 - "version": "1.0.2",
221 - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
222 - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
223 - },
224 - "node_modules/debug": {
225 - "version": "2.6.9",
226 - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
227 - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
228 - "dependencies": {
229 - "ms": "2.0.0"
230 - }
231 - },
232 - "node_modules/denque": {
233 - "version": "1.5.0",
234 - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz",
235 - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==",
236 - "engines": {
237 - "node": ">=0.10"
238 - }
239 - },
240 - "node_modules/depd": {
241 - "version": "1.1.2",
242 - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
243 - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
244 - "engines": {
245 - "node": ">= 0.6"
246 - }
247 - },
248 - "node_modules/destroy": {
249 - "version": "1.0.4",
250 - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
251 - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
252 - },
253 - "node_modules/ee-first": {
254 - "version": "1.1.1",
255 - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
256 - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
257 - },
258 - "node_modules/ejs": {
259 - "version": "3.1.6",
260 - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz",
261 - "integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==",
262 - "dependencies": {
263 - "jake": "^10.6.1"
264 - },
265 - "bin": {
266 - "ejs": "bin/cli.js"
267 - },
268 - "engines": {
269 - "node": ">=0.10.0"
270 - }
271 - },
272 - "node_modules/encodeurl": {
273 - "version": "1.0.2",
274 - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
275 - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
276 - "engines": {
277 - "node": ">= 0.8"
278 - }
279 - },
280 - "node_modules/escape-html": {
281 - "version": "1.0.3",
282 - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
283 - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
284 - },
285 - "node_modules/escape-string-regexp": {
286 - "version": "1.0.5",
287 - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
288 - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
289 - "engines": {
290 - "node": ">=0.8.0"
291 - }
292 - },
293 - "node_modules/etag": {
294 - "version": "1.8.1",
295 - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
296 - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
297 - "engines": {
298 - "node": ">= 0.6"
299 - }
300 - },
301 - "node_modules/express": {
302 - "version": "4.17.1",
303 - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
304 - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
305 - "dependencies": {
306 - "accepts": "~1.3.7",
307 - "array-flatten": "1.1.1",
308 - "body-parser": "1.19.0",
309 - "content-disposition": "0.5.3",
310 - "content-type": "~1.0.4",
311 - "cookie": "0.4.0",
312 - "cookie-signature": "1.0.6",
313 - "debug": "2.6.9",
314 - "depd": "~1.1.2",
315 - "encodeurl": "~1.0.2",
316 - "escape-html": "~1.0.3",
317 - "etag": "~1.8.1",
318 - "finalhandler": "~1.1.2",
319 - "fresh": "0.5.2",
320 - "merge-descriptors": "1.0.1",
321 - "methods": "~1.1.2",
322 - "on-finished": "~2.3.0",
323 - "parseurl": "~1.3.3",
324 - "path-to-regexp": "0.1.7",
325 - "proxy-addr": "~2.0.5",
326 - "qs": "6.7.0",
327 - "range-parser": "~1.2.1",
328 - "safe-buffer": "5.1.2",
329 - "send": "0.17.1",
330 - "serve-static": "1.14.1",
331 - "setprototypeof": "1.1.1",
332 - "statuses": "~1.5.0",
333 - "type-is": "~1.6.18",
334 - "utils-merge": "1.0.1",
335 - "vary": "~1.1.2"
336 - },
337 - "engines": {
338 - "node": ">= 0.10.0"
339 - }
340 - },
341 - "node_modules/express-session": {
342 - "version": "1.17.1",
343 - "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.1.tgz",
344 - "integrity": "sha512-UbHwgqjxQZJiWRTMyhvWGvjBQduGCSBDhhZXYenziMFjxst5rMV+aJZ6hKPHZnPyHGsrqRICxtX8jtEbm/z36Q==",
345 - "dependencies": {
346 - "cookie": "0.4.0",
347 - "cookie-signature": "1.0.6",
348 - "debug": "2.6.9",
349 - "depd": "~2.0.0",
350 - "on-headers": "~1.0.2",
351 - "parseurl": "~1.3.3",
352 - "safe-buffer": "5.2.0",
353 - "uid-safe": "~2.1.5"
354 - },
355 - "engines": {
356 - "node": ">= 0.8.0"
357 - }
358 - },
359 - "node_modules/express-session/node_modules/depd": {
360 - "version": "2.0.0",
361 - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
362 - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
363 - "engines": {
364 - "node": ">= 0.8"
365 - }
366 - },
367 - "node_modules/express-session/node_modules/safe-buffer": {
368 - "version": "5.2.0",
369 - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
370 - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
371 - },
372 - "node_modules/filelist": {
373 - "version": "1.0.2",
374 - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz",
375 - "integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==",
376 - "dependencies": {
377 - "minimatch": "^3.0.4"
378 - }
379 - },
380 - "node_modules/finalhandler": {
381 - "version": "1.1.2",
382 - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
383 - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
384 - "dependencies": {
385 - "debug": "2.6.9",
386 - "encodeurl": "~1.0.2",
387 - "escape-html": "~1.0.3",
388 - "on-finished": "~2.3.0",
389 - "parseurl": "~1.3.3",
390 - "statuses": "~1.5.0",
391 - "unpipe": "~1.0.0"
392 - },
393 - "engines": {
394 - "node": ">= 0.8"
395 - }
396 - },
397 - "node_modules/forwarded": {
398 - "version": "0.1.2",
399 - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
400 - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
401 - "engines": {
402 - "node": ">= 0.6"
403 - }
404 - },
405 - "node_modules/fresh": {
406 - "version": "0.5.2",
407 - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
408 - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
409 - "engines": {
410 - "node": ">= 0.6"
411 - }
412 - },
413 - "node_modules/has-flag": {
414 - "version": "3.0.0",
415 - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
416 - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
417 - "engines": {
418 - "node": ">=4"
419 - }
420 - },
421 - "node_modules/http-errors": {
422 - "version": "1.7.2",
423 - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
424 - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
425 - "dependencies": {
426 - "depd": "~1.1.2",
427 - "inherits": "2.0.3",
428 - "setprototypeof": "1.1.1",
429 - "statuses": ">= 1.5.0 < 2",
430 - "toidentifier": "1.0.0"
431 - },
432 - "engines": {
433 - "node": ">= 0.6"
434 - }
435 - },
436 - "node_modules/iconv-lite": {
437 - "version": "0.4.24",
438 - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
439 - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
440 - "dependencies": {
441 - "safer-buffer": ">= 2.1.2 < 3"
442 - },
443 - "engines": {
444 - "node": ">=0.10.0"
445 - }
446 - },
447 - "node_modules/inherits": {
448 - "version": "2.0.3",
449 - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
450 - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
451 - },
452 - "node_modules/ipaddr.js": {
453 - "version": "1.9.1",
454 - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
455 - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
456 - "engines": {
457 - "node": ">= 0.10"
458 - }
459 - },
460 - "node_modules/isarray": {
461 - "version": "1.0.0",
462 - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
463 - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
464 - },
465 - "node_modules/jake": {
466 - "version": "10.8.2",
467 - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz",
468 - "integrity": "sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A==",
469 - "dependencies": {
470 - "async": "0.9.x",
471 - "chalk": "^2.4.2",
472 - "filelist": "^1.0.1",
473 - "minimatch": "^3.0.4"
474 - },
475 - "bin": {
476 - "jake": "bin/cli.js"
477 - },
478 - "engines": {
479 - "node": "*"
480 - }
481 - },
482 - "node_modules/kareem": {
483 - "version": "2.3.2",
484 - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.2.tgz",
485 - "integrity": "sha512-STHz9P7X2L4Kwn72fA4rGyqyXdmrMSdxqHx9IXon/FXluXieaFA6KJ2upcHAHxQPQ0LeM/OjLrhFxifHewOALQ=="
486 - },
487 - "node_modules/media-typer": {
488 - "version": "0.3.0",
489 - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
490 - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
491 - "engines": {
492 - "node": ">= 0.6"
493 - }
494 - },
495 - "node_modules/memory-pager": {
496 - "version": "1.5.0",
497 - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
498 - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
499 - "optional": true
500 - },
501 - "node_modules/merge-descriptors": {
502 - "version": "1.0.1",
503 - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
504 - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
505 - },
506 - "node_modules/method-override": {
507 - "version": "3.0.0",
508 - "resolved": "https://registry.npmjs.org/method-override/-/method-override-3.0.0.tgz",
509 - "integrity": "sha512-IJ2NNN/mSl9w3kzWB92rcdHpz+HjkxhDJWNDBqSlas+zQdP8wBiJzITPg08M/k2uVvMow7Sk41atndNtt/PHSA==",
510 - "dependencies": {
511 - "debug": "3.1.0",
512 - "methods": "~1.1.2",
513 - "parseurl": "~1.3.2",
514 - "vary": "~1.1.2"
515 - },
516 - "engines": {
517 - "node": ">= 0.10"
518 - }
519 - },
520 - "node_modules/method-override/node_modules/debug": {
521 - "version": "3.1.0",
522 - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
523 - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
524 - "dependencies": {
525 - "ms": "2.0.0"
526 - }
527 - },
528 - "node_modules/methods": {
529 - "version": "1.1.2",
530 - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
531 - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
532 - "engines": {
533 - "node": ">= 0.6"
534 - }
535 - },
536 - "node_modules/mime": {
537 - "version": "1.6.0",
538 - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
539 - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
540 - "bin": {
541 - "mime": "cli.js"
542 - },
543 - "engines": {
544 - "node": ">=4"
545 - }
546 - },
547 - "node_modules/mime-db": {
548 - "version": "1.47.0",
549 - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz",
550 - "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==",
551 - "engines": {
552 - "node": ">= 0.6"
553 - }
554 - },
555 - "node_modules/mime-types": {
556 - "version": "2.1.30",
557 - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz",
558 - "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==",
559 - "dependencies": {
560 - "mime-db": "1.47.0"
561 - },
562 - "engines": {
563 - "node": ">= 0.6"
564 - }
565 - },
566 - "node_modules/minimatch": {
567 - "version": "3.0.4",
568 - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
569 - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
570 - "dependencies": {
571 - "brace-expansion": "^1.1.7"
572 - },
573 - "engines": {
574 - "node": "*"
575 - }
576 - },
577 - "node_modules/mongodb": {
578 - "version": "3.6.6",
579 - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
580 - "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
581 - "dependencies": {
582 - "bl": "^2.2.1",
583 - "bson": "^1.1.4",
584 - "denque": "^1.4.1",
585 - "optional-require": "^1.0.2",
586 - "safe-buffer": "^5.1.2"
587 - },
588 - "engines": {
589 - "node": ">=4"
590 - },
591 - "optionalDependencies": {
592 - "saslprep": "^1.0.0"
593 - },
594 - "peerDependenciesMeta": {
595 - "aws4": {
596 - "optional": true
597 - },
598 - "bson-ext": {
599 - "optional": true
600 - },
601 - "kerberos": {
602 - "optional": true
603 - },
604 - "mongodb-client-encryption": {
605 - "optional": true
606 - },
607 - "mongodb-extjson": {
608 - "optional": true
609 - },
610 - "snappy": {
611 - "optional": true
612 - }
613 - }
614 - },
615 - "node_modules/mongoose": {
616 - "version": "5.12.8",
617 - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.8.tgz",
618 - "integrity": "sha512-+6Q8mvTsIHQkXBWmBGnEy93Gm0fjKIwV/AEIT23wXN3O4Pd3L/aZaJWrdOStcuE4b9SqXrs1QBnnR9MNqNZwrw==",
619 - "dependencies": {
620 - "@types/mongodb": "^3.5.27",
621 - "bson": "^1.1.4",
622 - "kareem": "2.3.2",
623 - "mongodb": "3.6.6",
624 - "mongoose-legacy-pluralize": "1.0.2",
625 - "mpath": "0.8.3",
626 - "mquery": "3.2.5",
627 - "ms": "2.1.2",
628 - "regexp-clone": "1.0.0",
629 - "safe-buffer": "5.2.1",
630 - "sift": "13.5.2",
631 - "sliced": "1.0.1"
632 - },
633 - "engines": {
634 - "node": ">=4.0.0"
635 - },
636 - "funding": {
637 - "type": "opencollective",
638 - "url": "https://opencollective.com/mongoose"
639 - }
640 - },
641 - "node_modules/mongoose-legacy-pluralize": {
642 - "version": "1.0.2",
643 - "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz",
644 - "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==",
645 - "peerDependencies": {
646 - "mongoose": "*"
647 - }
648 - },
649 - "node_modules/mongoose/node_modules/ms": {
650 - "version": "2.1.2",
651 - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
652 - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
653 - },
654 - "node_modules/mongoose/node_modules/safe-buffer": {
655 - "version": "5.2.1",
656 - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
657 - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
658 - "funding": [
659 - {
660 - "type": "github",
661 - "url": "https://github.com/sponsors/feross"
662 - },
663 - {
664 - "type": "patreon",
665 - "url": "https://www.patreon.com/feross"
666 - },
667 - {
668 - "type": "consulting",
669 - "url": "https://feross.org/support"
670 - }
671 - ]
672 - },
673 - "node_modules/mpath": {
674 - "version": "0.8.3",
675 - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz",
676 - "integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA==",
677 - "engines": {
678 - "node": ">=4.0.0"
679 - }
680 - },
681 - "node_modules/mquery": {
682 - "version": "3.2.5",
683 - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz",
684 - "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==",
685 - "dependencies": {
686 - "bluebird": "3.5.1",
687 - "debug": "3.1.0",
688 - "regexp-clone": "^1.0.0",
689 - "safe-buffer": "5.1.2",
690 - "sliced": "1.0.1"
691 - },
692 - "engines": {
693 - "node": ">=4.0.0"
694 - }
695 - },
696 - "node_modules/mquery/node_modules/debug": {
697 - "version": "3.1.0",
698 - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
699 - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
700 - "dependencies": {
701 - "ms": "2.0.0"
702 - }
703 - },
704 - "node_modules/ms": {
705 - "version": "2.0.0",
706 - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
707 - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
708 - },
709 - "node_modules/negotiator": {
710 - "version": "0.6.2",
711 - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
712 - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
713 - "engines": {
714 - "node": ">= 0.6"
715 - }
716 - },
717 - "node_modules/on-finished": {
718 - "version": "2.3.0",
719 - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
720 - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
721 - "dependencies": {
722 - "ee-first": "1.1.1"
723 - },
724 - "engines": {
725 - "node": ">= 0.8"
726 - }
727 - },
728 - "node_modules/on-headers": {
729 - "version": "1.0.2",
730 - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
731 - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
732 - "engines": {
733 - "node": ">= 0.8"
734 - }
735 - },
736 - "node_modules/optional-require": {
737 - "version": "1.0.3",
738 - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
739 - "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==",
740 - "engines": {
741 - "node": ">=4"
742 - }
743 - },
744 - "node_modules/parseurl": {
745 - "version": "1.3.3",
746 - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
747 - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
748 - "engines": {
749 - "node": ">= 0.8"
750 - }
751 - },
752 - "node_modules/passport": {
753 - "version": "0.4.1",
754 - "resolved": "https://registry.npmjs.org/passport/-/passport-0.4.1.tgz",
755 - "integrity": "sha512-IxXgZZs8d7uFSt3eqNjM9NQ3g3uQCW5avD8mRNoXV99Yig50vjuaez6dQK2qC0kVWPRTujxY0dWgGfT09adjYg==",
756 - "dependencies": {
757 - "passport-strategy": "1.x.x",
758 - "pause": "0.0.1"
759 - },
760 - "engines": {
761 - "node": ">= 0.4.0"
762 - }
763 - },
764 - "node_modules/passport-local": {
765 - "version": "1.0.0",
766 - "resolved": "https://registry.npmjs.org/passport-local/-/passport-local-1.0.0.tgz",
767 - "integrity": "sha1-H+YyaMkudWBmJkN+O5BmYsFbpu4=",
768 - "dependencies": {
769 - "passport-strategy": "1.x.x"
770 - },
771 - "engines": {
772 - "node": ">= 0.4.0"
773 - }
774 - },
775 - "node_modules/passport-strategy": {
776 - "version": "1.0.0",
777 - "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
778 - "integrity": "sha1-tVOaqPwiWj0a0XlHbd8ja0QPUuQ=",
779 - "engines": {
780 - "node": ">= 0.4.0"
781 - }
782 - },
783 - "node_modules/path-to-regexp": {
784 - "version": "0.1.7",
785 - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
786 - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
787 - },
788 - "node_modules/pause": {
789 - "version": "0.0.1",
790 - "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
791 - "integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10="
792 - },
793 - "node_modules/process-nextick-args": {
794 - "version": "2.0.1",
795 - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
796 - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
797 - },
798 - "node_modules/proxy-addr": {
799 - "version": "2.0.6",
800 - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
801 - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
802 - "dependencies": {
803 - "forwarded": "~0.1.2",
804 - "ipaddr.js": "1.9.1"
805 - },
806 - "engines": {
807 - "node": ">= 0.10"
808 - }
809 - },
810 - "node_modules/qs": {
811 - "version": "6.7.0",
812 - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
813 - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
814 - "engines": {
815 - "node": ">=0.6"
816 - }
817 - },
818 - "node_modules/random-bytes": {
819 - "version": "1.0.0",
820 - "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
821 - "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=",
822 - "engines": {
823 - "node": ">= 0.8"
824 - }
825 - },
826 - "node_modules/range-parser": {
827 - "version": "1.2.1",
828 - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
829 - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
830 - "engines": {
831 - "node": ">= 0.6"
832 - }
833 - },
834 - "node_modules/raw-body": {
835 - "version": "2.4.0",
836 - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
837 - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
838 - "dependencies": {
839 - "bytes": "3.1.0",
840 - "http-errors": "1.7.2",
841 - "iconv-lite": "0.4.24",
842 - "unpipe": "1.0.0"
843 - },
844 - "engines": {
845 - "node": ">= 0.8"
846 - }
847 - },
848 - "node_modules/readable-stream": {
849 - "version": "2.3.7",
850 - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
851 - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
852 - "dependencies": {
853 - "core-util-is": "~1.0.0",
854 - "inherits": "~2.0.3",
855 - "isarray": "~1.0.0",
856 - "process-nextick-args": "~2.0.0",
857 - "safe-buffer": "~5.1.1",
858 - "string_decoder": "~1.1.1",
859 - "util-deprecate": "~1.0.1"
860 - }
861 - },
862 - "node_modules/regexp-clone": {
863 - "version": "1.0.0",
864 - "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz",
865 - "integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw=="
866 - },
867 - "node_modules/safe-buffer": {
868 - "version": "5.1.2",
869 - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
870 - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
871 - },
872 - "node_modules/safer-buffer": {
873 - "version": "2.1.2",
874 - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
875 - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
876 - },
877 - "node_modules/saslprep": {
878 - "version": "1.0.3",
879 - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
880 - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
881 - "optional": true,
882 - "dependencies": {
883 - "sparse-bitfield": "^3.0.3"
884 - },
885 - "engines": {
886 - "node": ">=6"
887 - }
888 - },
889 - "node_modules/send": {
890 - "version": "0.17.1",
891 - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
892 - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
893 - "dependencies": {
894 - "debug": "2.6.9",
895 - "depd": "~1.1.2",
896 - "destroy": "~1.0.4",
897 - "encodeurl": "~1.0.2",
898 - "escape-html": "~1.0.3",
899 - "etag": "~1.8.1",
900 - "fresh": "0.5.2",
901 - "http-errors": "~1.7.2",
902 - "mime": "1.6.0",
903 - "ms": "2.1.1",
904 - "on-finished": "~2.3.0",
905 - "range-parser": "~1.2.1",
906 - "statuses": "~1.5.0"
907 - },
908 - "engines": {
909 - "node": ">= 0.8.0"
910 - }
911 - },
912 - "node_modules/send/node_modules/ms": {
913 - "version": "2.1.1",
914 - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
915 - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
916 - },
917 - "node_modules/serve-static": {
918 - "version": "1.14.1",
919 - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
920 - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
921 - "dependencies": {
922 - "encodeurl": "~1.0.2",
923 - "escape-html": "~1.0.3",
924 - "parseurl": "~1.3.3",
925 - "send": "0.17.1"
926 - },
927 - "engines": {
928 - "node": ">= 0.8.0"
929 - }
930 - },
931 - "node_modules/setprototypeof": {
932 - "version": "1.1.1",
933 - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
934 - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
935 - },
936 - "node_modules/sift": {
937 - "version": "13.5.2",
938 - "resolved": "https://registry.npmjs.org/sift/-/sift-13.5.2.tgz",
939 - "integrity": "sha512-+gxdEOMA2J+AI+fVsCqeNn7Tgx3M9ZN9jdi95939l1IJ8cZsqS8sqpJyOkic2SJk+1+98Uwryt/gL6XDaV+UZA=="
940 - },
941 - "node_modules/sliced": {
942 - "version": "1.0.1",
943 - "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
944 - "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E="
945 - },
946 - "node_modules/sparse-bitfield": {
947 - "version": "3.0.3",
948 - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
949 - "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
950 - "optional": true,
951 - "dependencies": {
952 - "memory-pager": "^1.0.2"
953 - }
954 - },
955 - "node_modules/statuses": {
956 - "version": "1.5.0",
957 - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
958 - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
959 - "engines": {
960 - "node": ">= 0.6"
961 - }
962 - },
963 - "node_modules/string_decoder": {
964 - "version": "1.1.1",
965 - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
966 - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
967 - "dependencies": {
968 - "safe-buffer": "~5.1.0"
969 - }
970 - },
971 - "node_modules/supports-color": {
972 - "version": "5.5.0",
973 - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
974 - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
975 - "dependencies": {
976 - "has-flag": "^3.0.0"
977 - },
978 - "engines": {
979 - "node": ">=4"
980 - }
981 - },
982 - "node_modules/toidentifier": {
983 - "version": "1.0.0",
984 - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
985 - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
986 - "engines": {
987 - "node": ">=0.6"
988 - }
989 - },
990 - "node_modules/type-is": {
991 - "version": "1.6.18",
992 - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
993 - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
994 - "dependencies": {
995 - "media-typer": "0.3.0",
996 - "mime-types": "~2.1.24"
997 - },
998 - "engines": {
999 - "node": ">= 0.6"
1000 - }
1001 - },
1002 - "node_modules/uid-safe": {
1003 - "version": "2.1.5",
1004 - "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
1005 - "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
1006 - "dependencies": {
1007 - "random-bytes": "~1.0.0"
1008 - },
1009 - "engines": {
1010 - "node": ">= 0.8"
1011 - }
1012 - },
1013 - "node_modules/unpipe": {
1014 - "version": "1.0.0",
1015 - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
1016 - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
1017 - "engines": {
1018 - "node": ">= 0.8"
1019 - }
1020 - },
1021 - "node_modules/util-deprecate": {
1022 - "version": "1.0.2",
1023 - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
1024 - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
1025 - },
1026 - "node_modules/utils-merge": {
1027 - "version": "1.0.1",
1028 - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
1029 - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
1030 - "engines": {
1031 - "node": ">= 0.4.0"
1032 - }
1033 - },
1034 - "node_modules/vary": {
1035 - "version": "1.1.2",
1036 - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
1037 - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
1038 - "engines": {
1039 - "node": ">= 0.8"
1040 - }
1041 - }
1042 - },
1043 "dependencies": { 6 "dependencies": {
1044 "@types/bson": { 7 "@types/bson": {
1045 "version": "4.0.3", 8 "version": "4.0.3",
...@@ -1080,6 +43,11 @@ ...@@ -1080,6 +43,11 @@
1080 "color-convert": "^1.9.0" 43 "color-convert": "^1.9.0"
1081 } 44 }
1082 }, 45 },
46 + "append-field": {
47 + "version": "1.0.0",
48 + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
49 + "integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY="
50 + },
1083 "array-flatten": { 51 "array-flatten": {
1084 "version": "1.1.1", 52 "version": "1.1.1",
1085 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 53 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
...@@ -1145,6 +113,43 @@ ...@@ -1145,6 +113,43 @@
1145 "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", 113 "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz",
1146 "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==" 114 "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg=="
1147 }, 115 },
116 + "buffer-from": {
117 + "version": "1.1.1",
118 + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
119 + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
120 + },
121 + "busboy": {
122 + "version": "0.2.14",
123 + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz",
124 + "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=",
125 + "requires": {
126 + "dicer": "0.2.5",
127 + "readable-stream": "1.1.x"
128 + },
129 + "dependencies": {
130 + "isarray": {
131 + "version": "0.0.1",
132 + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
133 + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
134 + },
135 + "readable-stream": {
136 + "version": "1.1.14",
137 + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
138 + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
139 + "requires": {
140 + "core-util-is": "~1.0.0",
141 + "inherits": "~2.0.1",
142 + "isarray": "0.0.1",
143 + "string_decoder": "~0.10.x"
144 + }
145 + },
146 + "string_decoder": {
147 + "version": "0.10.31",
148 + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
149 + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
150 + }
151 + }
152 + },
1148 "bytes": { 153 "bytes": {
1149 "version": "3.1.0", 154 "version": "3.1.0",
1150 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 155 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
...@@ -1178,6 +183,17 @@ ...@@ -1178,6 +183,17 @@
1178 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 183 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
1179 "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 184 "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
1180 }, 185 },
186 + "concat-stream": {
187 + "version": "1.6.2",
188 + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
189 + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
190 + "requires": {
191 + "buffer-from": "^1.0.0",
192 + "inherits": "^2.0.3",
193 + "readable-stream": "^2.2.2",
194 + "typedarray": "^0.0.6"
195 + }
196 + },
1181 "connect-flash": { 197 "connect-flash": {
1182 "version": "0.1.1", 198 "version": "0.1.1",
1183 "resolved": "https://registry.npmjs.org/connect-flash/-/connect-flash-0.1.1.tgz", 199 "resolved": "https://registry.npmjs.org/connect-flash/-/connect-flash-0.1.1.tgz",
...@@ -1234,6 +250,38 @@ ...@@ -1234,6 +250,38 @@
1234 "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 250 "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
1235 "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 251 "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
1236 }, 252 },
253 + "dicer": {
254 + "version": "0.2.5",
255 + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz",
256 + "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=",
257 + "requires": {
258 + "readable-stream": "1.1.x",
259 + "streamsearch": "0.1.2"
260 + },
261 + "dependencies": {
262 + "isarray": {
263 + "version": "0.0.1",
264 + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
265 + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
266 + },
267 + "readable-stream": {
268 + "version": "1.1.14",
269 + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
270 + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
271 + "requires": {
272 + "core-util-is": "~1.0.0",
273 + "inherits": "~2.0.1",
274 + "isarray": "0.0.1",
275 + "string_decoder": "~0.10.x"
276 + }
277 + },
278 + "string_decoder": {
279 + "version": "0.10.31",
280 + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
281 + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
282 + }
283 + }
284 + },
1237 "ee-first": { 285 "ee-first": {
1238 "version": "1.1.1", 286 "version": "1.1.1",
1239 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 287 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
...@@ -1487,6 +535,19 @@ ...@@ -1487,6 +535,19 @@
1487 "brace-expansion": "^1.1.7" 535 "brace-expansion": "^1.1.7"
1488 } 536 }
1489 }, 537 },
538 + "minimist": {
539 + "version": "1.2.5",
540 + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
541 + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
542 + },
543 + "mkdirp": {
544 + "version": "0.5.5",
545 + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
546 + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
547 + "requires": {
548 + "minimist": "^1.2.5"
549 + }
550 + },
1490 "mongodb": { 551 "mongodb": {
1491 "version": "3.6.6", 552 "version": "3.6.6",
1492 "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", 553 "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
...@@ -1534,8 +595,7 @@ ...@@ -1534,8 +595,7 @@
1534 "mongoose-legacy-pluralize": { 595 "mongoose-legacy-pluralize": {
1535 "version": "1.0.2", 596 "version": "1.0.2",
1536 "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", 597 "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz",
1537 - "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==", 598 + "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ=="
1538 - "requires": {}
1539 }, 599 },
1540 "mpath": { 600 "mpath": {
1541 "version": "0.8.3", 601 "version": "0.8.3",
...@@ -1569,11 +629,31 @@ ...@@ -1569,11 +629,31 @@
1569 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 629 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
1570 "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 630 "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
1571 }, 631 },
632 + "multer": {
633 + "version": "1.4.2",
634 + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.2.tgz",
635 + "integrity": "sha512-xY8pX7V+ybyUpbYMxtjM9KAiD9ixtg5/JkeKUTD6xilfDv0vzzOFcCp4Ljb1UU3tSOM3VTZtKo63OmzOrGi3Cg==",
636 + "requires": {
637 + "append-field": "^1.0.0",
638 + "busboy": "^0.2.11",
639 + "concat-stream": "^1.5.2",
640 + "mkdirp": "^0.5.1",
641 + "object-assign": "^4.1.1",
642 + "on-finished": "^2.3.0",
643 + "type-is": "^1.6.4",
644 + "xtend": "^4.0.0"
645 + }
646 + },
1572 "negotiator": { 647 "negotiator": {
1573 "version": "0.6.2", 648 "version": "0.6.2",
1574 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 649 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
1575 "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 650 "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
1576 }, 651 },
652 + "object-assign": {
653 + "version": "4.1.1",
654 + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
655 + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
656 + },
1577 "on-finished": { 657 "on-finished": {
1578 "version": "2.3.0", 658 "version": "2.3.0",
1579 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 659 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
...@@ -1774,6 +854,11 @@ ...@@ -1774,6 +854,11 @@
1774 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 854 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
1775 "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 855 "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
1776 }, 856 },
857 + "streamsearch": {
858 + "version": "0.1.2",
859 + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
860 + "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo="
861 + },
1777 "string_decoder": { 862 "string_decoder": {
1778 "version": "1.1.1", 863 "version": "1.1.1",
1779 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 864 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
...@@ -1804,6 +889,11 @@ ...@@ -1804,6 +889,11 @@
1804 "mime-types": "~2.1.24" 889 "mime-types": "~2.1.24"
1805 } 890 }
1806 }, 891 },
892 + "typedarray": {
893 + "version": "0.0.6",
894 + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
895 + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
896 + },
1807 "uid-safe": { 897 "uid-safe": {
1808 "version": "2.1.5", 898 "version": "2.1.5",
1809 "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", 899 "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
...@@ -1831,6 +921,11 @@ ...@@ -1831,6 +921,11 @@
1831 "version": "1.1.2", 921 "version": "1.1.2",
1832 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 922 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
1833 "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 923 "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
924 + },
925 + "xtend": {
926 + "version": "4.0.2",
927 + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
928 + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
1834 } 929 }
1835 } 930 }
1836 } 931 }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
18 "express-session": "^1.17.1", 18 "express-session": "^1.17.1",
19 "method-override": "^3.0.0", 19 "method-override": "^3.0.0",
20 "mongoose": "^5.12.8", 20 "mongoose": "^5.12.8",
21 + "multer": "^1.4.2",
21 "passport": "^0.4.1", 22 "passport": "^0.4.1",
22 "passport-local": "^1.0.0" 23 "passport-local": "^1.0.0"
23 } 24 }
......
...@@ -7,6 +7,32 @@ var util = require('../util'); ...@@ -7,6 +7,32 @@ var util = require('../util');
7 7
8 // Post home 8 // Post home
9 router.get('/', function(req, res){ 9 router.get('/', function(req, res){
10 + var page = Math.max(1, parseInt(req.query.page));
11 + var limit = Math.max(1, parseInt(req.query.limit));
12 + page = !isNaN(page)?page:1;
13 + limit = !isNaN(limit)?limit:10;
14 +
15 + var searchQuery = createSearchQuery(req.query); // 1
16 +
17 + var skip = (page-1)*limit;
18 + var count = await Post.countDocuments(searchQuery); // 1-1
19 + var maxPage = Math.ceil(count/limit);
20 + var posts = await Post.find(searchQuery) // 1-2
21 + .populate('author')
22 + .sort('-createdAt')
23 + .skip(skip)
24 + .limit(limit)
25 + .exec();
26 +
27 + res.render('posts/index', {
28 + posts:posts,
29 + currentPage:page,
30 + maxPage:maxPage,
31 + limit:limit,
32 + searchType:req.query.searchType, // 2
33 + searchText:req.query.searchText // 2
34 + });
35 + });
10 Post.find({}) 36 Post.find({})
11 .populate('author') 37 .populate('author')
12 .sort('-createdAt') 38 .sort('-createdAt')
...@@ -14,7 +40,6 @@ router.get('/', function(req, res){ ...@@ -14,7 +40,6 @@ router.get('/', function(req, res){
14 if(err){return res.json(err)}; 40 if(err){return res.json(err)};
15 res.render('posts/index', {posts:posts}); 41 res.render('posts/index', {posts:posts});
16 }); 42 });
17 -});
18 43
19 44
20 // Post new 45 // Post new
...@@ -34,10 +59,26 @@ router.post('/', util.isLoggedin, function(req, res){ ...@@ -34,10 +59,26 @@ router.post('/', util.isLoggedin, function(req, res){
34 req.flash('errors', util.parseError(err)); 59 req.flash('errors', util.parseError(err));
35 return res.redirect('/posts/new'); 60 return res.redirect('/posts/new');
36 }; 61 };
37 - res.redirect('/posts'); 62 + res.redirect('/posts'+res.locals.getPostQueryString(false, { page:1, searchText:'' }));
38 }); 63 });
39 }); 64 });
40 65
66 +function createSearchQuery(queries){
67 + var searchQuery = {};
68 + if(queries.searchType && queries.searchText && queries.searchText.length >= 3){ // 1
69 + var searchTypes = queries.searchType.toLowerCase().split(',');
70 + var postQueries = [];
71 + if(searchTypes.indexOf('title')>=0){
72 + postQueries.push({ title: { $regex: new RegExp(queries.searchText, 'i') } }); // 2
73 + }
74 + if(searchTypes.indexOf('body')>=0){
75 + postQueries.push({ body: { $regex: new RegExp(queries.searchText, 'i') } });
76 + }
77 + if(postQueries.length > 0) searchQuery = {$or:postQueries}; // 3
78 + }
79 + return searchQuery;
80 + }
81 +
41 82
42 // Post show 83 // Post show
43 router.get('/:id', util.isLoggedin, function(req, res){ 84 router.get('/:id', util.isLoggedin, function(req, res){
......
...@@ -33,6 +33,26 @@ util.noPermission = function(req, res){ ...@@ -33,6 +33,26 @@ util.noPermission = function(req, res){
33 res.redirect('/login'); 33 res.redirect('/login');
34 } 34 }
35 35
36 +util.getPostQueryString = function(req, res, next){
37 + res.locals.getPostQueryString = function(isAppended=false, overwrites={}){
38 + var queryString = '';
39 + var queryArray = [];
40 + var page = overwrites.page?overwrites.page:(req.query.page?req.query.page:'');
41 + var limit = overwrites.limit?overwrites.limit:(req.query.limit?req.query.limit:'');
42 + var searchType = overwrites.searchType?overwrites.searchType:(req.query.searchType?req.query.searchType:''); // 1
43 + var searchText = overwrites.searchText?overwrites.searchText:(req.query.searchText?req.query.searchText:''); // 1
36 44
45 + if(page) queryArray.push('page='+page);
46 + if(limit) queryArray.push('limit='+limit);
47 + if(searchType) queryArray.push('searchType='+searchType); // 1
48 + if(searchText) queryArray.push('searchText='+searchText); // 1
49 +
50 + if(queryArray.length>0) queryString = (isAppended?'&':'?') + queryArray.join('&');
51 +
52 + return queryString;
53 + }
54 + next();
55 +}
56 +
57 +module.exports = util;
37 58
38 -module.exports = util;
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,11 +6,10 @@ ...@@ -6,11 +6,10 @@
6 </head> 6 </head>
7 <body> 7 <body>
8 <%- include('../partials/nav') %> 8 <%- include('../partials/nav') %>
9 - 9 +
10 <div class="container mb-3"> 10 <div class="container mb-3">
11 <div> 11 <div>
12 - <h2 class="mb-3" style="font-weight: bold; font-style:italic; float:left;">Memory</h2> 12 + <h2 class="mb-3" style="font-weight: bold; font-style:italic; float:left;">Memory</h2>
13 -
14 <div style="float:right"> 13 <div style="float:right">
15 <% if(isAuthenticated){ %> 14 <% if(isAuthenticated){ %>
16 <a class="btn btn-outline-primary" href="/posts/new">Write Memory</a> 15 <a class="btn btn-outline-primary" href="/posts/new">Write Memory</a>
...@@ -57,5 +56,26 @@ ...@@ -57,5 +56,26 @@
57 56
58 57
59 </div> 58 </div>
59 + <form action="/posts" method="get" class="post-index-tool"> <!-- 1 -->
60 + <div class="form-row">
61 +
62 + <div class="form-group col-9"> <!-- 2 -->
63 + <label>Search</label>
64 + <div class="input-group">
65 + <select name="searchType" class="custom-select">
66 + <option value="title,body" <% searchType=='title,body'?'selected':'' %>>Title, Body</option>
67 + <option value="title" <%= searchType=='title'?'selected':'' %>>Title</option>
68 + <option value="body" <%= searchType=='body'?'selected':''' %>>Body</option>
69 + </select>
70 + <input minLength="3" type="text" name="searchText" value="<%= searchText %>">
71 + <div class="input-group-append">
72 + <button class="btn btn-outline-primary" type="submit">search</button>
73 + </div>
74 + </div>
75 + </div>
76 +
77 + </div>
78 + </form>
79 +
60 </body> 80 </body>
61 </html> 81 </html>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
48 <%= errors.unhandled %> 48 <%= errors.unhandled %>
49 </div> 49 </div>
50 <% } %> 50 <% } %>
51 - 51 +
52 <div style="float:right"> 52 <div style="float:right">
53 <a class="btn btn-outline-secondary" href="/posts">Back</a> 53 <a class="btn btn-outline-secondary" href="/posts">Back</a>
54 <button type="submit" class="btn btn-outline-primary">Submit</button> 54 <button type="submit" class="btn btn-outline-primary">Submit</button>
......