Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.59 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.59 KB

Moesif Fastify Example

Fastify is web framework for node.js.

Moesif is an API analytics and Monetization platform.

moesif-nodejs is a middleware that makes integration with Moesif easy for Nodejs based apps including Express.

This example is a Fastify application with Moesif's API analytics middleware integrated.

Fastify Middleware

Per fastify documentation, by default, fastify do NOT support any middleware out of the box. You must use one of two plugins: @fastify/express or @fastify/middie in order to use ANY middleware.

How to run this example.

  1. Install all dependencies:
npm install
  1. Add your Moesif Application Id to server.js

Your Moesif Application Id can be found in the Moesif Portal. After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.

You can always find your Moesif Application Id at any time by logging into the Moesif Portal, clicking on the bottom-left menu, and then clicking Installation.

const moesifOptions = {
  applicationId: "your application id"
};
  1. Run the example, it will listen on port 5000.
node server.js
  1. Send some requests to some of the routes and verify that the API calls are captured in your Moesif account.
curl http://localhost:3050