52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
/*
|
|
|--------------------------------------------------------------------------
|
|
| Routes file
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The routes file is used for defining the HTTP routes.
|
|
|
|
|
*/
|
|
|
|
import router from '@adonisjs/core/services/router'
|
|
|
|
const KeywordsController = () => import('#controllers/keywords_controller')
|
|
const AuctionsController = () => import('#controllers/auctions_controller')
|
|
const ParseLogsController = () => import('#controllers/parse_logs_controller')
|
|
|
|
router.on('/').render('pages/home')
|
|
|
|
// Health check endpoint for Docker
|
|
router.get('/health', async ({ response }) => {
|
|
return response.ok({ status: 'ok', timestamp: new Date().toISOString() })
|
|
})
|
|
|
|
// List recent auctions (last 3 days)
|
|
router.get('/list', [AuctionsController, 'list'])
|
|
|
|
// HTML view of recent auctions (last 3 days)
|
|
router.get('/list-view', [AuctionsController, 'listView'])
|
|
|
|
// Trigger auction parsing
|
|
router.post('/trigger-parse', [AuctionsController, 'triggerParse'])
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| API Routes
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
router.group(() => {
|
|
// Keywords
|
|
router.get('/keywords', [KeywordsController, 'index'])
|
|
router.post('/keywords', [KeywordsController, 'store'])
|
|
router.delete('/keywords/:id', [KeywordsController, 'destroy'])
|
|
|
|
// Auctions
|
|
router.get('/auctions/search', [AuctionsController, 'search'])
|
|
router.get('/auctions/:id', [AuctionsController, 'show'])
|
|
router.get('/auctions', [AuctionsController, 'index'])
|
|
|
|
// Parse Logs
|
|
router.get('/parse-logs', [ParseLogsController, 'index'])
|
|
}).prefix('/api')
|