Skip to content

Commit

Permalink
Merge pull request #227 from podium-lib/example-touchup
Browse files Browse the repository at this point in the history
chore: clearer naming of the plugin in docs / examples
  • Loading branch information
leftieFriele authored Sep 18, 2023
2 parents 3485f0f + 126de03 commit de4c8b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This module require Fastify v2.0.0 or newer.
Build a simple podlet server:

```js
const fastifyPodlet = require('@podium/fastify-podlet');
const fastifyPodletPlugin = require('@podium/fastify-podlet');
const fastify = require('fastify');
const Podlet = require('@podium/podlet');

Expand All @@ -35,7 +35,8 @@ const podlet = new Podlet({
name: 'podletContent',
});

app.register(fastifyPodlet, podlet);
// Register the plugin, with the podlet as the option
app.register(fastifyPodletPlugin, podlet);

app.get(podlet.content(), async (request, reply) => {
if (reply.app.podium.context.locale === 'nb-NO') {
Expand Down Expand Up @@ -68,7 +69,7 @@ server `.register()` method together with an instance of the [@podium/podlet]
class.

```js
app.register(FastifyPodlet, podlet);
app.register(fastifyPodletPlugin, podlet);
```

## Request params
Expand Down
4 changes: 2 additions & 2 deletions example/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const FastifyPodlet = require('../');
const fastifyPodletPlugin = require('../');
const fastify = require('fastify');
const Podlet = require('@podium/podlet');

Expand All @@ -19,7 +19,7 @@ podlet.defaults({
locale: 'nb-NO',
});

app.register(FastifyPodlet, podlet);
app.register(fastifyPodletPlugin, podlet);

app.get(podlet.content(), async (request, reply) => {
if (reply.app.podium.context.locale === 'nb-NO') {
Expand Down
4 changes: 2 additions & 2 deletions test/podlet-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { request } = require('@podium/test-utils');
const fastify = require('fastify');
const Podlet = require('@podium/podlet');
const tap = require('tap');
const FastifyPodlet = require('..');
const fastifyPodletPlugin = require('..');

class Server {
constructor(options = {}) {
Expand All @@ -27,7 +27,7 @@ class Server {
locale: 'nb-NO',
});

this.app.register(FastifyPodlet, podlet);
this.app.register(fastifyPodletPlugin, podlet);
this.app.register(fastifyForm); // Needed to handle non GET requests

this.app.get(podlet.content(), async (req, reply) => {
Expand Down

0 comments on commit de4c8b8

Please sign in to comment.