Once you're ready to deploy to production it's time to hook up Alinea to a backend. Alinea exposes a handler that can be hosted on most Javascript runtimes (Node.js or edge/serverless functions). The handler needs access to a backend service that can authenticate users, store drafts and publish changes back to the git repository.
Create the CMS handler in the app folder.
import {cms} from '@/cms'
export const GET = cms.backendHandler
export const POST = cms.backendHandler
Update your CMS config to inform Alinea where the handler is located and where to generate the admin dashboard.
export const cms = createCMS({
// schema and workspaces ...
dashboard: {
handlerUrl: '/api/cms',
staticFile: 'public/admin.html',
dashboardUrl: '/admin.html'
}
})
While building your project, an admin folder will be created together with the staticFile as defined within your CMS config. Exclude the admin path and the staticFile from git by adding them to your .gitignore file:
/public/admin*
Deploy your code and follow the instructions on /admin.html to configure your backend.