Factor has a simple plugin system that you can use to add server and application plugins.
Because of Factor's distributed nature, the application and server are designed to run independently of each other. For that reason many plugins export:
So to properly install a plugin you may need to add it twice: add the 'app' plugin to index.ts
and add the 'server' plugin to server.ts
Each plugin can determine it's options and installation procedure, for that reason you'll need to reference the plugin documentation (e.g. readme file) for specifics on how to use that plugin
To add the Blog Engine plugin, add it to both server.ts
and index.ts
// SERVER PLUGIN
// FILE: server.ts
import { ServiceConfig } from "@factor/api"
import blogEngineServer from "@factor/plugin-blog-engine/server"
import { map } from "./blog-article-map"
export const setup = (): ServiceConfig => {
return {
plugins: [blogEngineServer({ map, baseRoute: "/blog" })],
}
}
// APP PLUGIN
// FILE: index.ts
import { ServiceConfigApp } from "@factor/api"
import blogEngine from "@factor/plugin-blog-engine"
import { map } from "./blog-article-map"
export const setup = (): ServiceConfigApp => {
return {
plugins: [blogEngine({ map, baseRoute: "/blog" })],
}
}