How cywhale/apigate works
Project type and purpose
• This is a Node.js–based backend API service (no frontend) that provides oceanographic data (CTD and SADCP) via both REST and GraphQL endpoints.
• It’s designed to serve clients who request mean data for research vessels around Taiwan. It also includes Swagger for API documentation and can be deployed/managed with PM2.
File structure
Top-level:
• server/ – contains the entire application
– package.json & pnpm-lock.yaml – dependency and lock files
– pm2.sh – PM2 deployment script
– src/
• config/ – DB (Knex, Sequelize), cache, Swagger setup
• graphql/ – schema, resolvers, query definitions
• plugins/ – Redis and in-memory cache plugins
• routes/ – REST API route handlers (ctd, sadcp, apirest)
• index.mjs & srvapp.mjs – service initialization & Express/Koa app setup
– tests/ – unit tests for cache and config
Patterns & Indicators:
• Single microservice exposing both REST (routes) and GraphQL endpoints
• Cache layer (Redis, in-memory) to speed up repeated queries
• Database abstraction via Knex and Sequelize
• Swagger for interactive API documentation
README for additional insights
• Confirms two main REST API entry points (/api/ctd, /api/sadcp) and live Swagger UI
• Mentions usage examples and DOI/citation