/strapi-middleware-nextjs

Strapi Middleware to use nextJS as the front end framework for strapi.

Primary LanguageJavaScript

Strapi NextJS Middleware

How it works

Creates additional routing details for the root url of your project.

Installing

Using npm

npm install --save strapi-middleware-nextjs next react react-dom

Using yarn

yarn add strapi-middleware-nextjs next react react-dom

Setup

For Strapi stable versions, add a middleware.js file within your config folder

e.g

touch config/middleware.js
module.exports = {
  settings: {
    public: {
        defaultIndex: false
    }
  },
};

and in your root directory create a pages folder

touch pages/index.js

Paste inside index.js

function HomePage() {
  return <div>Welcome to Next.js!</div>
}

export default HomePage
strapi build
strapi run

Strapi Middleware NextJS Config

"enabled": boolean, // Enable or disable the middle ware based on config
"overripeApiRoutes": boolean, // Enable or disable the api route adjustment [default:"/api/{route}"), false:"/{route}" ]
"enableProd": boolean, // Enable NextJS middleware in production environment