Added home and charts pages

This commit is contained in:
RemixDev
2021-04-21 21:13:47 +02:00
parent 0b810d7188
commit 902a9563a6
9 changed files with 537 additions and 28 deletions

View File

@@ -0,0 +1,13 @@
import { ApiHandler } from '../../../types'
import { getCharts } from '../../../main'
const path: ApiHandler['path'] = '/getCharts'
const handler: ApiHandler['handler'] = async (_, res) => {
const chartsData = await getCharts()
res.send(chartsData)
}
const apiHandler: ApiHandler = { path, handler }
export default apiHandler

View File

@@ -1,9 +1,11 @@
import { ApiHandler } from '../../../types'
import { getHome } from '../../../main'
const path: ApiHandler['path'] = '/getHome'
const handler: ApiHandler['handler'] = (_, res) => {
res.send('getHome')
const handler: ApiHandler['handler'] = async (_, res) => {
const homeData = await getHome()
res.send(homeData)
}
const apiHandler: ApiHandler = { path, handler }

View File

@@ -1,4 +1,5 @@
import sample from './sample'
import getHome from './getHome'
import getCharts from './getCharts'
export default [sample, getHome]
export default [sample, getHome, getCharts]

View File

@@ -8,7 +8,7 @@ const router = express.Router()
* @since 0.0.0
*/
router.get('/', (_, res) => {
res.render('index', { title: 'Express' })
res.render('index', { title: 'deemix' })
})
export default router

View File

@@ -1,14 +0,0 @@
import express from 'express'
const router = express.Router()
/**
* GET users listing.
*
* @since 0.0.0
*/
router.get('/', (_, res) => {
res.send('respond with a resource')
})
export default router