1. The manifest
  2. 2The route
  3. 3The card
  4. 4Install
Getting started2 / 4

The route

A route is a function: Hodi calls it, it answers. This one reads the Greeting setting and sends it back.

What you do
  1. Open server/index.ts: it's the part of your plugin that runs on the server.
  2. 2On the highlighted line, add an exclamation mark after greeting, in the text the route sends back.
  3. 3Click Say hello in the preview: your route answers Hi!.
1import type { ServerPlugin } from '@hodi-app/plugin-sdk/server'23const plugin: ServerPlugin = {4  routes: {5    'POST /hello': async (_request, ctx) => {6      const { greeting } = ctx.settings()7      return { body: { text: `${greeting}` } }8    }9  }10}1112export default plugin
PreviewLive

Hello world

Your first plugin.

GreetingHi
Say helloYour route's answer