Being able to auto type API endpoint according the use. This could be achieveable using TypeScript template literals.
Example:
Having these API endpoints:
/api/users/api/companies
Being able to auto type API endpoint according the use. This could be achieveable using TypeScript template literals.
Example:
Having these API endpoints:
/api/users/api/companiesBeing able to auto type API endpoint according the use. This could be achieveable using TypeScript template literals.
Example:
Having these API endpoints:
/api/users/api/companies| export const DangerousRawHtml = ({ html = "" }) => ( | |
| <script dangerouslySetInnerHTML={{ __html: `</script>${html}<script>` }} /> | |
| ); |
| const puppeteer = require('puppeteer-core'); | |
| const cheerio = require('cheerio'); | |
| const chrome = require('chrome-aws-lambda'); | |
| export default async (req, res) => { | |
| const slug = req?.query?.slug; | |
| if (!slug) { | |
| res.statusCode = 200 | |
| res.setHeader('Content-Type', 'application/json') | |
| res.end(JSON.stringify({ id: null })) |
| /** | |
| * @Post("/magic_link_signup") | |
| */ | |
| function magicLinkSignUp($request) { | |
| // get the query parameters from the post request | |
| $queryParams = $request->query()->all(); | |
| // get the token from queryParams | |
| // this $token is the same $randomString that was | |
| // generated in Step 1 |
| /** | |
| * pass mobile number of the user for whom | |
| * you want to create an authenticated link, | |
| * this mobile number may/may not be in your | |
| * user's database | |
| */ | |
| function createMagicLink($mobileNumber, $targetScreenUrl) { | |
| // generate a random string of length 8 | |
| $randomString = generateRandomString(8); | |
| $maskedRandomString = generateMaskedRandomString($randomString); |
| import { useEffect, useRef, useState } from 'react'; | |
| import firebase from 'firebase/app'; | |
| import equal from 'deep-equal'; | |
| function filterKeys(raw, allowed) { | |
| if (!raw) { | |
| return raw; | |
| } | |
| const s = new Set(allowed); | |
| return Object.keys(raw) |
| const renderFields = fields => | |
| Object.keys(fields).map((name, i) => { | |
| if (!fields[name].input) return null; | |
| return ( | |
| <Grid item xs={12}> | |
| <Field | |
| key={name} | |
| name={name} | |
| label={fields.labels[i]} | |
| {...fields[name]} |
| <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
| <style> | |
| .square, | |
| .landscape { visibility: hidden; } | |
| .portrait { visibility: visible; } | |
| @media (min-aspect-ratio: 1/1) { | |
| .portrait, | |
| .landscape { visibility: hidden; } | |
| .square { visibility: visible; } |