mempool/backend
2022-01-28 13:53:29 +09:00
..
.vscode Backend: Bumping Typescript version to 4.4.2 (#748) 2021-08-31 15:09:33 +03:00
cache Optimized cache chunks. Default cache files to /cache directory. 2021-02-14 19:50:31 +07:00
src Increment migration schema version to 3 and re-add pools and blocks table creation queries 2022-01-28 13:53:29 +09:00
.gitignore Adding sync external assets feature. 2021-12-21 02:00:50 +04:00
mempool-config.sample.json Add pools.json to EXTERNAL_ASSETS - Now supports updating the table 2022-01-20 13:53:08 +09:00
package-lock.json Bump version number to v2.4.0-dev 2022-01-16 15:41:23 +09:00
package.json Migrate pools.json to the database in one command - Updated latest pools.json file from Blockchain-Known-Pools master 2022-01-28 13:50:58 +09:00
README.md Add backend README - Backend watchers setup 2022-01-28 13:50:58 +09:00
tsconfig.json Upgrading backend libraries 2021-12-09 13:24:29 +04:00
tslint.json Bitcoind: Use mempool as address index when doing address prefix search. 2021-01-11 01:51:57 +07:00

Setup backend watchers

The backend is static. Typescript scripts are compiled into the dist folder and served through a node web server.

You can avoid the manual shutdown/recompile/restart command line cycle by setting up watchers.

Make sure you are in the backend directory cd backend.

  1. Install nodemon
sudo npm install -g nodemon
  1. [Optional] Add the following configuration into tsconfig.json. You can find watch options here https://www.typescriptlang.org/docs/handbook/configuring-watch.html
    "watchOptions": {
      "watchFile": "useFsEvents",
      "watchDirectory": "useFsEvents",
      "fallbackPolling": "dynamicPriority",
      "synchronousWatchDirectory": true,
      "excludeDirectories": ["**/node_modules", "_build"],
      "excludeFiles": ["build/fileWhichChangesOften.ts"]
    }
  1. In one terminal, watch typescript scripts
./node_modules/typescript/bin/tsc --watch
  1. In another terminal, watch compiled javascript
nodemon --max-old-space-size=2048 dist/index.js

Everytime you save a backend .ts file, tsc will recompile it and genereate a new static .js file in the dist folder. nodemon will detect this new file and restart the node web server automatically.