文件名称:bla:为服务器端和客户端创建自己的API方法的简便方法
文件大小:84KB
文件格式:ZIP
更新时间:2024-05-22 07:27:03
TypeScript
bla 安装 npm i bla 另外,您需要安装运行来定义参数架构。 npm i runtypes 快速开始 服务器端 编写API方法声明 import { ApiMethod } from 'bla/server' ; import * as runtypes from 'runtypes' ; const helloMethod = new ApiMethod ( { params : runtypes . Record ( { name : runtypes . String } ) , action : params => `Hello, ${ params . name } ` ; } ) ; export default helloMethod ; 将其保存到api/hello.ts 。 使用声明的方法创建api imp
【文件预览】:
bla-master
----.eslintrc(3KB)
----src()
--------shared()
--------client()
--------server()
----.travis.yml(110B)
----tsconfig.json(366B)
----LICENSE(1KB)
----rollup.config.ts(874B)
----jest.config.js(349B)
----README.md(2KB)
----jestSetup.ts(224B)
----.huskyrc(64B)
----.gitignore(62B)
----CHANGELOG.md(6KB)
----package-lock.json(282KB)
----package.json(1KB)