Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Apr 19, 2023
0 parents commit 6dd0d24
Show file tree
Hide file tree
Showing 9 changed files with 2,369 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = LF
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HUB_URL=https://snapshot.org
15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build and Run Tests
on: [push]
jobs:
build-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- run: yarn install
- run: yarn build
- run: yarn lint
- run: yarn typecheck
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
node_modules
dist
build
.env
coverage

# Remove some common IDE working directories
.idea
.vscode
*.log
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Snapshot/Sidekick

Sidekick is the service serving all proposals' votes CSV report

<hr>

This service is exposing an API endpoint expecting a closed proposal ID, and will
return a CSV file with all the given proposal's votes.

NOTE: CSV files are generated only once, then cached, making this service a cache middleware
for snapshot-hub, for proposals' votes.

## Project Setup

> yarn
Set the hub API url in the `.env` file

```
HUB_URL=
```

## Compiles and hot-reloads for development

```
yarn dev
```

## Linting and typecheck

```
yarn lint
yarn typecheck
```

## License

[MIT](https://github.com/snapshot-labs/envelop-ui/blob/bootstrap-app/LICENSE)
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "snapshot-sidekick",
"version": "0.0.1",
"main": "index.js",
"repository": "snapshot-labs/snapshot-sidekick",
"license": "MIT",
"scripts": {
"lint": "eslint src/ --ext .ts",
"lint:fix": "eslint src/ --ext .ts --fix",
"build": "tsc -p tsconfig.json",
"dev": "nodemon src/index.ts -e js,ts",
"start": "node dist/src/index.js",
"typecheck": "tsc"
},
"eslintConfig": {
"extends": "@snapshot-labs"
},
"prettier": "@snapshot-labs/prettier-config",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.18.2"
},
"devDependencies": {
"@snapshot-labs/eslint-config": "^0.1.0-beta.0",
"@snapshot-labs/prettier-config": "^0.1.0-beta.7",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"dotenv": "^16.0.3",
"eslint": "^8.38.0",
"eslint-plugin-prettier": "^4.2.1",
"nodemon": "^2.0.22",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'dotenv/config';
import express from 'express';
import cors from 'cors';

const app = express();
const PORT = process.env.PORT || 3000;

app.use(cors({ maxAge: 86400 }));

app.listen(PORT, () => console.log(`Listening at http://localhost:${PORT}`));
13 changes: 13 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"rootDir": "./",
"outDir": "./dist",
"esModuleInterop": true,
"strict": true,
"noImplicitAny": true,
"resolveJsonModule": true,
"moduleResolution": "Node"
}
}
Loading

0 comments on commit 6dd0d24

Please sign in to comment.