.ts
TypeScript
(application/typescript)
// 1st-party
import { ReqHandler } from "@ethicdevs/react-monolith";
// app
import { makeAuthService } from "../services/auth";
// app views
import HomeView, { HomeViewProps } from "../views/HomeView";

export const getHomeView: ReqHandler = async (request, reply) => {
  const authService = makeAuthService({ request });
  const reqHandler = reply.makeRequestHandler(request, reply);

  const foo = authService.isExistingUsername("test");
  const user = authService.findUserByUid((request.params as any).uid);

  const never = await authService.validateUserEmailAddress(
    "user-uid",
    "email@address.tld"
  );

  // TODO: Create a User model in db where to store user data.
  user; // so typescript do not complains about unused variable.
  never;

  return reqHandler<HomeViewProps>(HomeView.name, {
    foo,
  });
};