🔗
Table of contents
- Types should start with T:
import { ImageResponse } from '@vercel/og'; | |
import { NextRequest } from 'next/server'; | |
export const config = { | |
runtime: 'edge', | |
}; | |
const padZero = (str: string, len = 2) => { | |
const zeros = new Array(len).join('0'); | |
return (zeros + str).slice(-len); |
export const interceptor = async () => { | |
const { fetch: originalFetch } = window; | |
window.fetch = async (...args) => { | |
let [resource, config] = args; | |
const URLcutOff = "https://myapi.com"; | |
const trailing = resource.slice(URLcutOff.length); | |
console.log(trailing); | |
if (trailing.startsWith("/posts")) { | |
resource = `https://myapi.com`; | |
} |
module.exports = { | |
meta: { | |
type: "suggestion", | |
docs: { | |
description: "Enforce allowed child types for custom components", | |
category: "Best Practices", | |
recommended: true, | |
}, | |
}, | |
create(context) { |
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
const app = express(); | |
const port = 3000; | |
app.use(bodyParser()); | |
const USER_EMAIL = "[email protected]"; | |
const USER_PASSWORD = "123"; |