Middleman Server Template
The "task-middle-server-template" repository is a template designed to help developers create middle-layer servers that bridge Koii Task. It provides a foundational setup with essential components such as task queue management, server setup, and interaction with IPFS for fetching task data. The repository uses Node.js and MongoDB, leveraging Express.js for the server and async-await-queue for task handling. This template simplifies the creation of a task processing server by providing pre-built tools and structures.
For more details, visit the repository page here
Quick Start
To get started with the template, follow these steps:
- Clone the repository:
git clone https://github.com/koii-network/task-middle-server-template.git
- Install the dependencies using npm or yarn:
# Using npm
npm install
# Using yarn
yarn install
- Set up the environment variables:
cp .env.example .env
Configure the following variables in your .env
file:
TASK_ID
: The ID of the Koii task you want to processMONGO_URI
: Your MongoDB connection string (e.g., "mongodb://localhost:27017")DB_NAME
: Name of the database to useCOLLECTION_NAME
: Name of the collection to store task dataFILE_NAME
: Name of the file to process (if your task submission is a CID)
- Start the server:
# Using npm
npm start
# Using yarn
yarn start
To learn more about the template and its features, check next sections.