0.1.1 ⢠Published 3 years ago
@galatajs/core v0.1.1
What Is It?
It contains some core packages for the galatajs framework to work in certain standards. Although it was developed for the galatajs framework, you can use it if you want.
You don't have to use galatajs framework, @galatajs/core is a nodejs package.
š access on npm
Installation
npm install @galatajs/coreor with yarn
yarn add @galatajs/core
Usage Results
import { SuccessDataResult } from "@galatajs/core";
export type Product = {
id: number;
name: string;
price: number;
}
const product : Product = {
id: 1,
name: "Product 1",
price: 10
}
const result = new SuccessDataResult<Product>("Product created successfully", product);
console.log(result);
/**
success: true,
message: "Product created successfully",
data: { id: 1, name: "Product 1", price: 10 }
* */Usage Errors
import {BadRequestError} from "@galatajs/core";
const error = new BadRequestError("Product name is required");
console.log(error);
/**
success: false,
message: "Product name is required",
code: 400
* */When the framework is completed, the document will be made more detailed.