-
Install rosetta:
softwareupdate --install-rosetta
-
To check architecture mode in shell:
arch
-
x86_64/x64 mode:
i386
-
arm64 mode:
arm64
-
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
// app/api/revalidate/route.ts | |
import crypto from 'crypto'; | |
import { revalidatePath } from 'next/cache'; | |
import type { NextRequest } from 'next/server'; | |
import { NextResponse } from 'next/server'; | |
export const dynamic = 'force-dynamic'; | |
export async function GET(request: NextRequest) { |
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
// src/payload/utilities/revalidate.ts | |
import type { Payload } from 'payload'; | |
export const revalidate = async (args: { | |
slug: string; | |
payload: Payload; | |
}): Promise<void> => { | |
const { payload, slug } = args; |
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
{ | |
"blog_posts": [ | |
{ | |
"title": "Why obundle is Your Top Choice for BigCommerce Development", | |
"content": "In 2024, having a robust and scalable eCommerce platform is essential for business success. obundle, with its deep expertise in BigCommerce development, stands out as a leader in this space. Our team of seasoned developers understands the intricacies of the BigCommerce platform, ensuring that your store is not only functional but also optimized for performance. We offer tailored solutions that cater to your unique business needs, whether you’re a small startup or a large enterprise. With obundle, you’re not just getting a development service; you’re gaining a partner committed to helping your business thrive in the competitive eCommerce landscape.", | |
"shortDescription": "Discover why obundle is the top choice for BigCommerce development in 2024.", | |
"thumbnailImage": { | |
"url": "https://cdn11.bigcommerce.com/s-5unmz/images/stencil/original/image-manager/pexels-www-erzetich-co |
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 { CollectionConfig } from 'payload' | |
import { anyone } from '@/payload/access/anyone' | |
import { authenticated } from '@/payload/access/authenticated' | |
import { slugField } from '@/payload/fields/slug' | |
export const BlogPosts: CollectionConfig = { | |
slug: 'blog-posts', | |
admin: { | |
useAsTitle: 'title', |
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 { useTranslation } from 'react-i18next'; | |
import { ErrorPill } from 'payload/components'; | |
import type { Props } from 'payload/components/fields/Group'; | |
import { | |
createNestedFieldPath, | |
FieldDescription, | |
RenderFields, | |
useFormSubmitted, | |
} from 'payload/components/forms'; |
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
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps
and such. Instead you do client-only fetching with swr
, react-query
, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.