Skip to content

Commit

Permalink
chore: refact
Browse files Browse the repository at this point in the history
  • Loading branch information
npmstudy committed Nov 6, 2023
1 parent b6e6e2a commit 9700c9a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ rpc.add({

// rpc.mount();

rpc.listen(3000);
rpc.start(3000);
```


Expand Down
8 changes: 8 additions & 0 deletions packages/core2/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ rpc['fn']('/a', function (a) {
return { a: a };
});

rpc['add']({
c: (a: string) => {
return a;
},
a: function (a: string, b: string) {
return `${this.path} , ${a} c2 ${b}`;
},
});
// rpc.plugin(fn);
// rpc.plugin(demo);

Expand Down
4 changes: 3 additions & 1 deletion packages/core2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export function createServer(cfg?: any) {
rpc['fn'] = function (key, fun) {
fn.fn(key, fun);
};
// rpc['add'] = fn.add;
rpc['add'] = function (items) {
fn.add(items);
};

rpc.plugin(fn);

Expand Down

0 comments on commit 9700c9a

Please sign in to comment.