first-api & file-upload
This commit is contained in:
14
examples/first-api/backend/src/api/ApiHello.ts
Normal file
14
examples/first-api/backend/src/api/ApiHello.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { ReqHello, ResHello } from "../shared/protocols/PtlHello";
|
||||
|
||||
export async function ApiHello(call: ApiCall<ReqHello, ResHello>) {
|
||||
if (call.req.name === 'World') {
|
||||
call.succ({
|
||||
reply: 'Hello, ' + call.req.name,
|
||||
time: new Date()
|
||||
});
|
||||
}
|
||||
else {
|
||||
call.error('Invalid name');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user