0.14.10 • Published 1 year ago
@minimonolith/lib v0.14.10
@minimonolith/lib
@minimonolith/lib
is a library engine for achieving modularity and validation
Example Project
Here's an example library using @minimonolith/lib
:
.
├── package.json
├── .gitignore
├── index.js // Root of library
└── todo
├── services.js // Module 'todo' exported service handlers are declared here
└── get
├── handler.js // Module 'todo' service 'get' handler
├── in.js // Optional: Service 'get' handler in validation, if body not empty
└── out.js // Optional: Service 'get' handler out validation, if return not empty
index.js
This file exports the developed services of the library:
// index.js
'use strict';
import { getNewLib } from '@minimonolith/lib';
const LIB = await getNewLib();
await LIB.postModule('todo');
export default { ...LIB.SERVICES };
todo/index.js
Here, we declare the service handlers for the todo
module:
// todo/services.js
export default ['get', 'getOne', 'post', 'patch', 'delete'];
todo/getOne/handler.js
This file contains the get
service handler for the todo
module. It retrieves a todo item by its ID:
// todo/get/index.js
export default async ({ body }) => {
return { id: body.id, name: 'todo' };
}
todo/getOne/in.js
// todo/get/in.js
import { z } from '@minimonolith/lib';
export default () => ({
id: z.number()
});
todo/getOne/out.js
// todo/get/in.js
import { z } from '@minimonolith/lib';
export default () => ({
id: z.number(),
name: z.string(),
});
0.14.10
1 year ago
0.14.5
2 years ago
0.13.6
2 years ago
0.14.6
2 years ago
0.14.7
2 years ago
0.14.8
2 years ago
0.14.9
2 years ago
0.11.0
2 years ago
0.10.1
2 years ago
0.12.0
2 years ago
0.11.1
2 years ago
0.13.0
2 years ago
0.12.1
2 years ago
0.14.0
2 years ago
0.13.1
2 years ago
0.11.3
2 years ago
0.14.1
2 years ago
0.14.2
2 years ago
0.13.3
2 years ago
0.14.4
2 years ago
0.13.5
2 years ago
0.10.0
2 years ago
0.9.0
2 years ago
0.8.0
2 years ago
0.5.0
2 years ago
0.4.0
2 years ago
0.7.0
2 years ago
0.6.1
2 years ago
0.3.4
2 years ago
0.3.3
2 years ago
0.3.2
2 years ago
0.3.1
2 years ago
0.3.0
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.1.0
2 years ago
0.0.2
2 years ago