export async function getServerSideProps({ req, res, query }) {
const { id } = query
const cookies = Cookies(req, res)
const jwt = cookies.get('lit-auth')
if (!jwt) {
return {
props: {
authorized: false
This file contains 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
node_modules/@openzeppelin | |
└── contracts | |
├── README.md | |
├── access | |
│ ├── AccessControl.sol | |
│ ├── AccessControlEnumerable.sol | |
│ ├── IAccessControl.sol | |
│ ├── IAccessControlEnumerable.sol | |
│ └── Ownable.sol | |
├── build |
This file contains 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
<myusername>@<mycomputername> appBackend % npm run dev | |
> appbackend@0.0.0 dev | |
> nodemon --exec babel-node ./src/bin/www | |
[nodemon] 2.0.15 | |
[nodemon] to restart at any time, enter `rs` | |
[nodemon] watching path(s): *.* | |
[nodemon] watching extensions: js,mjs,json | |
[nodemon] starting `babel-node ./src/bin/www` |
This file contains 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
function getRandomString(length) { | |
const randomChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
let result = ''; | |
for ( let i = 0; i < length; i++ ) { | |
result += randomChars.charAt(Math.floor(Math.random() * randomChars.length)); | |
} | |
return result; | |
} | |
function hexToBase64(str) { | |
const stringChange = str.toString() |
This file contains 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 { handleRequest } from './handler' | |
addEventListener('fetch', (event) => { | |
event.respondWith(handleRequest(event.request)) | |
}) |
This file contains 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 Header from '../components/Header'; | |
import Footer from '../components/Footer'; | |
import dynamic from 'next/dynamic' | |
const DynamicComponentWithNoSSR = dynamic( | |
() => import('../components/Middle'), | |
{ ssr: false } | |
) | |
export default function Home() { |
This file contains 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 { Button } from 'react-bootstrap'; | |
import { GoogleAuth } from 'google-auth-library'; | |
const url = "https://us-central1-<projectId>.cloudfunctions.net/<functionName>"; | |
const keyFilename = "/path/to/key.json"; | |
class Middle extends React.Component { | |
async main() { | |
const auth = new GoogleAuth({keyFilename: keyFilename}) |
This file contains 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
export default function Home(props: any) { | |
... | |
function storePersistence() { | |
window.localStorage.setItem('personName', 'Firstname Lastname'); | |
} | |
function printPersistence() { | |
console.log(window.localStorage.getItem('personName')); |
This file contains 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 { useState } from "preact/hooks"; | |
import { useState, useEffect } from "preact/hooks"; | |
import { Handlers, PageProps } from "$fresh/server.ts"; | |
import UserDb from "../database.ts"; | |
interface CreatorProps { | |
email: string, | |
key: string | |
} |
This file contains 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 { Handlers, PageProps } from "$fresh/server.ts"; | |
import UserDb from "../../database.ts"; | |
export const handler = { | |
POST: async (request, ctx) => { | |
console.log(await request.json()); | |
if (!request.hasBody) { | |
ctx.status = 400; | |
ctx.body = { msg: "Invalid user data" }; | |
return ; |
OlderNewer