Skip to content

Commit

Permalink
feat: stop route
Browse files Browse the repository at this point in the history
  • Loading branch information
marklai1998 committed Oct 9, 2022
1 parent 886d165 commit f766391
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Koa from 'koa'
import Router from '@koa/router'
import { Line, lineConfig } from './constants/line'
import cors from '@koa/cors'
import { linesStops, Stop } from './constants/stop'
import { linesStops, Stop, stops } from './constants/stop'
import { scheduleService } from './services/scheduleService'
import './utils/dayjs'

Expand All @@ -20,6 +20,15 @@ router.get('/api/v1/lines/:line', async ctx => {
ctx.body = lineConfig[line as Line]
})

router.get('/api/v1/stops', async ctx => {
ctx.body = stops
})

router.get('/api/v1/stops/:stop', async ctx => {
const { stop } = ctx.params
ctx.body = stops[stop as Stop]
})

router.get('/api/v1/lines/:line/stops', async ctx => {
const { line } = ctx.params
ctx.body = linesStops[line as Line]
Expand Down

0 comments on commit f766391

Please sign in to comment.