Add a first cut at an express-based backend
This commit is contained in:
19
express/handlers.ts
Normal file
19
express/handlers.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { contentTypes } from "./content-types";
|
||||
import { httpCodes } from "./http-codes";
|
||||
import { services } from "./services";
|
||||
import { Call, Handler, Result } from "./types";
|
||||
|
||||
const multiHandler: Handler = async (call: Call): Promise<Result> => {
|
||||
const code = httpCodes.success.OK;
|
||||
const rn = services.random.randomNumber();
|
||||
|
||||
const retval: Result = {
|
||||
code,
|
||||
result: `that was ${call.method} (${rn})`,
|
||||
contentType: contentTypes.text.plain,
|
||||
};
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
export { multiHandler };
|
||||
Reference in New Issue
Block a user