/18-Valex

Primary LanguageTypeScript

Logo

Mock benefit card management API


Node.js Express.js Postgres

What I Learned

  • More about backend architecture and design
  • Express.js error handling and logging layers
  • Zod schema validation and type inference
  • Better TypeScript typing of Express entities
  • TS utilities like Omit and Partial

Routes

  • POST /cards

    • headers: x-api-key
    • body:
      employeeId: number,
      type: enum
  • POST /cards/:id/activate

    • body:
      cvc: string,
      password: string
  • POST /cards/:id/recharge

    • headers: x-api-key
    • body:
      amount: number
  • POST /cards/:id/block

    • body:
      password: string
  • POST /cards/:id/unblock

    • body:
      password: string
  • POST /cards/virtual

    • body:
      id: number,
      password: string
  • GET /cards/:id/balance

  • DELETE /cards/:id

    • body:
      id: number,
      password: string
  • POST /purchase

    • body:
      cardId: number
      password: string
      businessId: number
      amount: number
  • POST /purchase/online

    • body:
      cardId: number
      number: string
      name: string
      expirationDate: string
      securityCode: string
      businessId: number
      amount: number