*Use shorthand function
This commit is contained in:
parent
187e2f8fdf
commit
e7aedc9950
29
src/index.ts
29
src/index.ts
|
@ -1,28 +1,27 @@
|
|||
import type {Plugin, PluginAPI} from "@lumeweb/relay";
|
||||
import {RPCResponse} from "@lumeweb/relay";
|
||||
import type { Plugin, PluginAPI } from "@lumeweb/relay";
|
||||
import { RPCResponse } from "@lumeweb/relay";
|
||||
|
||||
const plugin: Plugin = {
|
||||
name: "core",
|
||||
async plugin(api: PluginAPI): Promise<void> {
|
||||
api.registerMethod("ping", {
|
||||
cacheable: false,
|
||||
handler: async (): Promise<RPCResponse | null> => {
|
||||
async handler(): Promise<RPCResponse | null> {
|
||||
return {
|
||||
data: "pong"
|
||||
}
|
||||
}
|
||||
})
|
||||
data: "pong",
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
api.registerMethod("get_methods", {
|
||||
cacheable: false,
|
||||
handler: async (): Promise<RPCResponse | null> => {
|
||||
async handler(): Promise<RPCResponse | null> {
|
||||
return {
|
||||
data: api.getMethods()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
data: api.getMethods(),
|
||||
};
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default plugin;
|
||||
|
|
Reference in New Issue