A step-by-step procedure from scratch that will guide you through the process of creating the APIS and dockerize the project
- Set Up Project Structure: Create a folder named "harperdb-docker" and navigate into it.
- Initialize Node.js Application: Use npm to initialize a Node.js application.
- Install Dependencies: Install necessary dependencies: express (web framework) and harperive (HarperDB connection).
- Create Application Structure: Organize project files by creating directories for controllers, routes, and utilities.
- Configure Express App: Set up an Express app in "index.js" with required middleware and route handling.
- HarperDB Connection: Create a connection to HarperDB in a "database.js" file inside the "util" folder.
- Create Test Endpoint: Design a test endpoint "/dev/version" in "dev.routes.js" to verify application functionality.
- Create CRUD Endpoints: Design CRUD endpoints in "users.routes.js" for creating, reading, updating, and deleting users.
- Implement Controllers: Create controller files for "dev" and "users" routes to handle requests and interact with HarperDB.
- Docker Setup: Create Docker configuration files: Dockerfile, docker-compose.yml, and .dockerignore.
- Configure Dockerfile: Set up Dockerfile with instructions for building the Docker image.
- Define docker-compose.yml: Create a docker-compose.yml file to manage the Docker service.
- Create .env File: Set environment variables in a ".env" file for Docker container configuration.
- Build Docker Image: Build the Docker image for the backend service.
- Run Docker Container: Start the application in a Docker container.
- Test Endpoints: Use Postman or HarperDB UI to test endpoints, such as "/dev/version".
- CRUD Operations: Test CRUD operations by sending requests to user-related endpoints.
- Monitor in UI: Monitor the database entries and operations using HarperDB UI.