http.ts 471 B

123456789101112131415
  1. import * as account from './account/api'
  2. import type { Context } from './types'
  3. import express from 'express'
  4. export function createExpress(ctx: Context) {
  5. const app = express()
  6. const prefix = ctx.config.api.prefix
  7. app.get(`${prefix}/account`, account.getAccount(ctx))
  8. app.put(`${prefix}/account`, account.getAccount(ctx))
  9. app.post(`${prefix}/account`, account.createAccount(ctx))
  10. app.delete(`${prefix}/account`, account.deleteAccount(ctx))
  11. return app
  12. }