Skip to content

Commit

Permalink
Add endpoint for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
bonustrack committed Oct 9, 2020
1 parent f1fbcec commit d7aa610
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
node_modules
npm-debug.log
.dockerignore
Dockerfile
Dockerfile
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version: "3.7"
services:

# Snapshot Hub
snap-hub:
# Snapshot hub
snapshot-hub:
build: .
container_name: snap-hub
container_name: snapshot-hub
env_file:
- .env.local
depends_on:
- snap-redis
- snapshot-redis
ports:
- "8080:8080"

# Snapshot Redis Instance
snap-redis:
# Snapshot Redis instance
snapshot-redis:
image: redis:6.0
container_name: snap-redis
# Snapshot MySQL Instance
snap-mysql:
container_name: snapshot-redis

# Snapshot MySQL instance
snapshot-mysql:
image: mysql:8.0.21
container_name: snap-mysql
container_name: snapshot-mysql
environment:
MYSQL_USER: "admin"
MYSQL_PASSWORD: "admin"
MYSQL_DATABASE: "testdb"

networks:
default:
name: snap-network
name: snapshot-network
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"start": "vue-cli-service express:run"
},
"dependencies": {
"@bonustrack/snapshot-spaces": "github:bonustrack/snapshot-spaces#master",
"@ethersproject/abi": "^5.0.1",
"@ethersproject/address": "^5.0.1",
"@ethersproject/constants": "^5.0.1",
Expand All @@ -35,6 +36,7 @@
"mysql": "^2.18.1",
"node-fetch": "^2.6.1",
"redis": "^3.0.2",
"require-context": "^1.1.0",
"typescript": "~3.9.3",
"vue": "^2.6.11",
"vue-cli-plugin-express": "^1.0.2"
Expand Down
6 changes: 6 additions & 0 deletions server/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import express from 'express';
import fetch from 'node-fetch';
import spaces from '@bonustrack/snapshot-spaces';
import redis from './helpers/redis';
import db from './helpers/mysql';
import relayer from './helpers/relayer';
Expand Down Expand Up @@ -28,6 +29,11 @@ router.get('/', (req, res) => {
});
});

router.get('/spaces/:key?', (req, res) => {
const { key } = req.params;
return res.json(key ? spaces[key] : spaces);
});

router.get('/:token/proposals', async (req, res) => {
const { token } = req.params;
const query = "SELECT * FROM messages WHERE type = 'proposal' AND token = ? ORDER BY timestamp DESC";
Expand Down

0 comments on commit d7aa610

Please sign in to comment.