diff --git a/README.md b/README.md index 761231a..52099f0 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ For server developement, server run at http://localhost:3003: 3. Start scheduler for crawl yahoo/imdb/ptt ![system diagram](https://github.com/Asing1001/system-diagrams/blob/master/mvrater.jpg?raw=true) +## Crawler + +- To manually run a single crawler you could reference firstTimeSetup.ts, and run `yarn setup` + ## Reference The project UI is using [Material-UI](https://github.com/callemall/material-ui) diff --git a/package.json b/package.json index b1f3460..a36a6aa 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "heroku-postbuild": "npm run build && npm run sitemap", "tsc:w": "tsc -w", "dev": "concurrently \"npm run tsc:w\" \"tsc && npm start\" \"npm run webpack\"", - "mergedata": "node dist/backgroundService/mergeDataJob.js" + "mergedata": "node dist/backgroundService/mergeDataJob.js", + "setup": "node dist/dbScript/firstTimeSetup" }, "private": true, "dependencies": { diff --git a/src/dbScript/firstTimeSetup.ts b/src/dbScript/firstTimeSetup.ts index 867fa1b..75b847b 100644 --- a/src/dbScript/firstTimeSetup.ts +++ b/src/dbScript/firstTimeSetup.ts @@ -14,6 +14,7 @@ async function setup() { await ensureCrawlerStatus(); await updateTheaterWithLocationList(); console.log('db setup done'); + process.exit(); } async function ensureCollectionAndIndex() {