Skip to content

Commit

Permalink
renamed /swagger to /docs
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Sep 20, 2024
1 parent 9be5a32 commit 7e1b22d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/server/routes/swagger.ts → src/server/routes/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Koa from 'koa'
import serve from 'koa-static'
import { koaSwagger } from 'koa2-swagger-ui'

export const setUpSwagger = (app: Koa) => {
export const setUpDocs = (app: Koa) => {
// Serve static folder, which contains the OpenAPI spec rendered by Swagger.
app.use(
serve(
Expand All @@ -26,7 +26,7 @@ export const setUpSwagger = (app: Koa) => {
koaSwagger({
title: 'DAO DAO API',
hideTopbar: true,
routePrefix: '/swagger',
routePrefix: '/docs',
favicon: 'https://daodao.zone/daodao.png',
swaggerOptions: {
url: './openapi.json',
Expand Down
4 changes: 2 additions & 2 deletions src/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Koa from 'koa'
import { Config } from '@/types'

import { accountRouter } from './account'
import { setUpDocs } from './docs'
import { indexerRouter } from './indexer'
import { setUpBullBoard } from './jobs'
import { setUpSwagger } from './swagger'

export type SetupRouterOptions = {
config: Config
Expand Down Expand Up @@ -34,7 +34,7 @@ export const setUpRouter = (
setUpBullBoard(app, config)

// Swagger API docs.
setUpSwagger(app)
setUpDocs(app)

// Indexer API.
router.use(indexerRouter.routes(), indexerRouter.allowedMethods())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import request from 'supertest'

import { app } from './app'

describe('openapi', () => {
it('JSON file exists', async () => {
describe('docs', () => {
it('OpenAPI JSON file exists', async () => {
await request(app.callback())
.get('/openapi.json')
.expect(200)
.expect('Content-Type', /json/)
})

it('renders', async () => {
await request(app.callback()).get('/swagger').expect(200)
await request(app.callback()).get('/docs').expect(200)
})
})

0 comments on commit 7e1b22d

Please sign in to comment.