Migrating to v1
Last updated on
In v1 we are dropping support for the /pages
folder and will only be working with the /app
directory in Next.js. The migration is quite simple.
Start by upgrading Outstatic.
# npm
npm install outstatic@latest
# yarn
yarn add outstatic@latest
#pnpm
pnpm install outstatic@latest
bash
Then, remove the outstatic
and api/outstatic
folders from your /pages
directory.
Next, you'll need to add two files to your /app
folder:
/app/outstatic/[[...ost]]/page.tsx
import 'outstatic/outstatic.css'
import { Outstatic } from 'outstatic'
import { OstClient } from 'outstatic/client'
export default async function Page({ params }: { params: { ost: string[] } }) {
const ostData = await Outstatic()
return <OstClient ostData={ostData} params={params} />
}
javascript
And /app/api/outstatic/[[...ost]]/route.ts
import { OutstaticApi } from 'outstatic'
export const GET = OutstaticApi.GET
export const POST = OutstaticApi.POST
javascript
That's it. Start your dev server and you are good to go!