This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import crypto from "crypto"; | |
| import { renderToStaticMarkup } from "react-dom/server"; | |
| import createMailgun from "mailgun-js"; | |
| import type { ActionFunction, LoaderFunction, Session } from "remix"; | |
| import { createCookieSessionStorage, json, redirect } from "remix"; | |
| /******************************************************************************* | |
| * Before we can do anything, we need to make sure the environment has | |
| * everything we need. If anything is missing, we just prevent the app from | |
| * starting up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { | |
| ActionFunction, | |
| LinksFunction, | |
| LoaderFunction, | |
| MetaFunction | |
| } from "@remix-run/react"; | |
| import { | |
| Meta, | |
| Links, | |
| Scripts, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require("path"); | |
| const express = require("express"); | |
| const compression = require("compression"); | |
| const morgan = require("morgan"); | |
| const { createRequestHandler } = require("@remix-run/express"); | |
| //////////////////////////////////////////////////////////////////////////////// | |
| let app = express(); | |
| app.use(compression()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum State { | |
| Idle, | |
| LoadingJwt, | |
| Success, | |
| Error, | |
| } | |
| type Data = { error?: string; jwt?: string }; | |
| function Comp() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ReactDOMServer from "react-dom/server"; | |
| import type { EntryContext } from "@remix-run/core"; | |
| import Remix from "@remix-run/react/server"; | |
| import { renderToString } from "react-dom/server"; | |
| import { ServerStyleSheet } from "styled-components"; | |
| import StylesContext from "./stylesContext"; | |
| export default function handleRequest( | |
| request: Request, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { Action, Loader } from "@remix-run/loader"; | |
| import { json, parseFormBody, redirect } from "@remix-run/loader"; | |
| import { readTodos, createTodo, deleteTodo } from "../data/todo"; | |
| let action: Action = async ({ request, context: { session } }) => { | |
| let [method, body] = await methodOverride(request); | |
| await new Promise((res) => setTimeout(res, 1000)); | |
| switch (method) { | |
| case "post": { | |
| let [_, error] = await createTodo(body!.name); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { Meta, Scripts, Styles, Routes } from "@remix-run/react"; | |
| import { useLocation } from "react-router-dom"; | |
| let noScriptPaths = new Set(["/", "/buy", "/logout", "/features", "/privacy"]); | |
| export default function App() { | |
| let location = useLocation() | |
| let includeScripts = !noScriptPaths.has(location.pathname); | |
| let { lang }= useLocalization() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { renderToNodeStream } from "react-dom/server"; | |
| import Remix, { loadRouteData } from "remix/RemixNode"; | |
| // same App as entry-web! | |
| import App from "./App"; | |
| export default async (req, res, assets, matches) => { | |
| // @remix-run/firebase is calling this function and passing | |
| // the arguments in, @remix-run/aws or @remix-run/azure will | |
| // pass in whatever APIs those platforms use | |
| // you have total control over the server rendering, here we |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Machine, assign } from "xstate"; | |
| import firebase from "./firebase"; | |
| const chart = { | |
| id: "auth", | |
| context: { | |
| auth: null, | |
| error: null, | |
| loggedoutTime: null | |
| }, |