Frameworks
Next.js
Run bknd inside Next.js
Installation
To get started with Next.js and bknd you can either install the package manually, and follow the descriptions below, or use the CLI starter:
Create a new Next.js CLI starter project by running the following command:
Serve the API
For more information about the connection object, refer to the Database guide.
Enabling the Admin UI
Create a file [[...admin]].tsx
inside the pages/admin
folder:
Example usage of the API in pages dir
Using pages dir, you need to wrap the getServerSideProps
function with withApi
to get access
to the API. With the API, you can query the database or retrieve the authentication status: