ContentRoutes is a set of routes to retrieve content.

const store: RedisStore
const contentRoutes = new ContentRoutes({ store })

const app = express()

app.get('/content/:slug', async (req, res) => {
res.send(await contentRoutes.getContent(req.params.slug))
})

Hierarchy

  • ContentRoutes

Constructors

Methods

Constructors

Methods

  • This route returns localised content for a given content slug an object like below, where each key you passed to languages above is present.

    {
    "content": {
    "en": "<p> The English text </p>",
    "fr": "<p> The French text </p>"
    }
    }

    Parameters

    • slug: string

    Returns Promise<LocalisedContent>

Generated using TypeDoc