Skip to content

Instantly share code, notes, and snippets.

@qunabu
Created April 19, 2020 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qunabu/e89492dcb1548d3c6e365d707b2de561 to your computer and use it in GitHub Desktop.
Save qunabu/e89492dcb1548d3c6e365d707b2de561 to your computer and use it in GitHub Desktop.
Strapi Heartbeat endpoint

my-project/api/heartbeat/config/routes.json

{
  "routes": [{
    "method": "GET",
    "path": "/heartbeat",
    "handler": "heartbeat.index",
    "config": {}
  }]
}

my-project/api/heartbeat/controllers/heartbeat.js

"use strict";

/**
 * Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/controllers.html#core-controllers)
 * to customize this controller
 */

module.exports = {
  index: async (ctx) => {
    ctx.send("Hello World!");
  },
};

my-project/api/heartbeat/services/heartbeat.js

'use strict';

/**
 * Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/services.html#core-services)
 * to customize this service
 */

module.exports = {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment