1234567891011121314151617181920212223242526272829303132 |
- const router = require('express').Router()
- import {
- Block,
- Event,
- Era,
- Account,
- Member,
- Post,
- Category,
- Thread,
- Proposal,
- } from '../db/models'
- router.get('/', async (req: any, res: any, next: any) => {
- try {
- res.json({
- blocks: await Block.findAll().then((blocks: any) => blocks.length),
- events: await Event.findAll().then((blocks: any) => blocks.length),
- eras: await Era.findAll().then((blocks: any) => blocks.length),
- accounts: await Account.findAll().then((blocks: any) => blocks.length),
- members: await Member.findAll().then((blocks: any) => blocks.length),
- categories: await Category.findAll().then((blocks: any) => blocks.length),
- threads: await Thread.findAll().then((blocks: any) => blocks.length),
- posts: await Post.findAll().then((blocks: any) => blocks.length),
- proposals: await Proposal.findAll().then((blocks: any) => blocks.length),
- })
- } catch (err) {
- next(err)
- }
- })
- module.exports = router
|