diff --git a/backend/src/app.ts b/backend/src/app.ts index 1150e5b..5d8b05f 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -11,17 +11,11 @@ console.log = Debug('invoiceIssuer:app.ts') const app = new Koa() app.use(koaBody()) -/** - * GET / - * @summary 返回欢迎信息。通常用于检查服务器是否正常运行。 - * @param {Koa.Context} ctx - Koa context object - */ -const getRoot = route.get('/', (ctx) => { - ctx.body = 'Hello World' -}) +app.use(route.get('/', (ctx) => { + ctx.body = 'Hello World' +})) - -const postPayer = route.post('/payer', async (ctx) => { +app.use(route.post('/payer', async (ctx) => { // TODO: 请求头验证 bearer token const { name, address, email, abn } = ctx.request.body @@ -41,16 +35,9 @@ const postPayer = route.post('/payer', async (ctx) => { ctx.throw(500, 'unknown_issues') } } -}) - -// 导出路由 -export { getRoot, postPayer } +})) const port = parseInt(process.env.PORT ?? '3000') app.listen(port, () => { - /** - * Server listening callback - * @summary Logs the server start message - */ - console.log(`Server is running at http://localhost:${port}`) + console.log(`Server is running at http://localhost:${port}`) }) \ No newline at end of file diff --git a/backend/src/func/createPayer.ts b/backend/src/func/createPayer.ts index 63e5729..f3f0932 100644 --- a/backend/src/func/createPayer.ts +++ b/backend/src/func/createPayer.ts @@ -6,5 +6,5 @@ * @param {string} email - 付款人的电子邮件地址 * @param {string} abn - 付款人的澳大利亚商业号码 */ -export default async (name: string, address: string, email: string, abn?: string) => { +export default async (name: string, address: string[], email: string, abn?: string) => { } \ No newline at end of file