https://github.com/application-research/storage-market-api
data layer
https://github.com/application-research/storage-market-api
Last synced: about 1 month ago
JSON representation
data layer
- Host: GitHub
- URL: https://github.com/application-research/storage-market-api
- Owner: application-research
- Created: 2022-12-19T02:22:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-11T06:09:18.000Z (almost 3 years ago)
- Last Synced: 2025-03-19T08:49:21.529Z (about 1 year ago)
- Language: TypeScript
- Size: 144 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# STORAGE_MARKET_API
docs: https://data.storage.market
To run it, you need to connect to our intelligence database (prod only). You can make your own though we won't stop you.
```
DOCUMENT_DATABASE_NAME=xxxx
DOCUMENT_DATABASE_USERNAME=xxxx
DOCUMENT_DATABASE_HOST=xxxx
DOCUMENT_DATABASE_PORT=5432
DOCUMENT_DATABASE_PASSWORD=xxxx
IEX_CLOUD_PUBLIC_KEY=xxxx
```
### Running a local Development Database
A docker file is provided to make it easy to set up a local development database for testing.
To do this,
1. Ensure you have Docker installed and running
2. Run the db start script `.dev/start.sh`
3. Source the environment file, which will cause the app to connect to the dev db, `source .dev/dev.env`
You can stop the dev db by running `.dev/stop.sh`
#### Purging the dev DB
DB tables will be persisted via a docker volume. You can purge all tables/data from the dev db by running
1. `.dev/purge.sh`
2. `.dev/start.sh` (re-creates container)
3. `.dev/start.sh` (run it a second time to start it up)
### Setup (MacOS)
Once you have environment variables specified, run the server
```sh
npm install
npm run dev
```
### Scripts
If you need to run node script without running the server, use this example to get started
```sh
# creates the tables you need
npm run script create
# updates the tables
npm run script update
# scans for database, typically a daily cron job
npm run script scan
# analysis, typically a daily cron job.
npm run script analysis
```