UNPKG

@digicms/cms

Version:

An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite

30 lines (21 loc) 683 B
'use strict'; const CLITable = require('cli-table3'); const chalk = require('chalk'); const { toUpper } = require('lodash/fp'); const strapi = require('../../index'); module.exports = async function () { const appContext = await strapi.compile(); const app = await strapi(appContext).load(); const list = app.server.listRoutes(); const infoTable = new CLITable({ head: [chalk.blue('Method'), chalk.blue('Path')], colWidths: [20], }); list .filter((route) => route.methods.length) .forEach((route) => { infoTable.push([route.methods.map(toUpper).join('|'), route.path]); }); console.log(infoTable.toString()); await app.destroy(); };