A Fastify-based API for managing polygons with endpoints to create, retrieve, and delete polygon records. It uses JSON-based storage along with auto-generated Swagger API documentation to facilitate development and testing.
-
Fastify Framework
High-performance Node.js framework for building scalable APIs. -
LowDB
Lightweight JSON-based database for simple storage needs. -
Swagger Documentation
Auto-generated and interactive API documentation. -
CORS Support
Configurable CORS settings to control resource sharing. -
Dockerized
Ready-to-use Docker setup for containerized deployment.
.
├── .env # Environment variables
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── index.js # Main application entry point
├── src/
│ ├── config/ # Configuration files
│ ├── db/ # Database setup
│ ├── routes/ # API route handlers
│ ├── schemas/ # JSON schemas for validation
│ └── utils/ # Utility functions
└── package.json # Project dependencies and scripts
git clone https://github.com/harut0111/fastify-polygons.git
cd fastify-polygonsnpm installPORT=3000
DELAY=1000
DB_FILE_NAME=db.json
CORS_ORIGIN=http://localhost:5173npm startAccess the API at http://localhost:3000.
For containerized deployment, follow these steps:
docker-compose builddocker-compose upOnce the container is running, access the API at http://localhost:3000.
npm run lintnpm run formatnpm testSwagger documentation for the API is available at:
http://localhost:3000/docs