Coder Social home page Coder Social logo

my-app777's Introduction

next recipe

The next recipe showcases one of the most powerful ways to implement Puck using to provide an authoring tool for any route in your Next app.

Demonstrates

  • Next.js 13 App Router implementation
  • JSON database implementation with HTTP API
  • Catch-all routes to use puck for any route on the platform
  • Incremental static regeneration (ISR) for all Puck pages

Usage

Run the generator and enter next when prompted

npx create-puck-app my-app

Start the server

yarn dev

Navigate to the homepage at https://localhost:3000. To edit the homepage, access the Puck editor at https://localhost:3000/edit.

You can do this for any route on the application, even if the page doesn't exist. For example, visit https://localhost:3000/hello/world and you'll receive a 404. You can author and publish a page by visiting https://localhost:3000/hello/world/edit. After publishing, go back to the original URL to see your page.

Using this recipe

To adopt this recipe you will need to:

  • IMPORTANT Add authentication to /edit routes. This can be done by modifying the example API routes in /app/puck/api/route.ts and server component in /app/puck/[...puckPath]/page.tsx. If you don't do this, Puck will be completely public.
  • Integrate your database into the API calls in /app/puck/api/route.ts
  • Implement a custom puck configuration in puck.config.tsx

By default, this recipe will generate static pages by setting dynamic to force-static in the /app/[...puckPath]/page.tsx. This will strip headers and cookies. If you need dynamic pages, you can delete this.

License

MIT © Measured Co.

my-app777's People

Contributors

buildbackbuehler avatar

Stargazers

Bruno Wego avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.