0.6.3 • Published 9 months ago

@jiangege47/micro-server v0.6.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

MicroServer

MicroServer is a lightweight web server designed to provide an easy-to-use and modular way to build web services. It is written in JavaScript and uses the Koa framework.

Installation

npm install @jiangege47/micro-server

Usage

Here is an example of how to use MicroServer:

const MicroServer = require("@jiangege47/micro-server");

const server = new MicroServer();
server.loadConfig();
server.start();

Call func

await server.call("test", "abc", "hello");

Loading Mechanism

The MicroServer module has a specific loading mechanism for your service logic files. Here's a quick guide to help you understand how it works and where to place your service files.

Default File Structure

The default file structure for a MicroServer service is as follows:

root/
  |- service/
  |  |- logic/
  |  |  |- service-logic.js
  |- micro-server.js

Service Files

Your service logic files should be placed in the logic/ folder under service/. Each service should have its own folder under logic/ containing one or more JavaScript files. These files should contain the logic for each service's individual functionality.

Naming Convention

The naming convention for service logic files is important. Each file should be named after the service it belongs to, followed by a hyphen and the logic it provides. For example: service-logic.js.

0.6.3

9 months ago

0.6.2

9 months ago

0.6.1

9 months ago

0.5.4

9 months ago

0.5.3

9 months ago

0.6.0

9 months ago

0.4.5

9 months ago

0.4.4

9 months ago

0.5.0

9 months ago

0.5.2

9 months ago

0.4.3

9 months ago

0.5.1

9 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.2.0

2 years ago