How to use strapi - 10 common examples

To help you get started, we’ve selected a few strapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / test / helpers / testAppGenerator.js View on Github external
const generateTestApp = async ({ appName, database }) => {
  const scope = {
    database: {
      settings: database,
      options: {},
    },
    rootPath: path.resolve(appName),
    name: appName,
    // disable quickstart run app after creation
    runQuickstartApp: false,
    // use pacakge version as strapiVersion (all packages have the same version);
    strapiVersion: require('strapi/package.json').version,
    debug: false,
    quick: false,
    uuid: undefined,
    deviceId: null,
    // use yarn if available and --use-npm isn't true
    useYarn: true,
    installDependencies: false,
    strapiDependencies: [
      'strapi',
      'strapi-admin',
      'strapi-utils',
      'strapi-plugin-content-type-builder',
      'strapi-plugin-content-manager',
      'strapi-plugin-users-permissions',
      'strapi-plugin-email',
      'strapi-plugin-upload',
github strapi / strapi / packages / strapi-hook-bookshelf / lib / utils / graphql.js View on Github external
fetchLatest: (collectionIdentity, collection, criteria) => {
    const filters = _.omit(helpers.handleFilters(criteria), value => {
      return _.isUndefined(value) || _.isNumber(value) ? _.isNull(value) : _.isEmpty(value);
    });

    // Handle filters
    filters.orderBy = 'createdAt DESC';
    filters.limit = filters.count;

    delete filters.count;

    return collection.forge(criteria)
      .query(filters)
      .fetchAll({withRelated: helpers.getAssociationsByIdentity(collectionIdentity)})
      .then(data => data.toJSON() || data);
  },
github loteoo / hyperapp-rocks / server.js View on Github external
// (should work without JS (no interaction but ok visuals))



// Front:
// preview hover links (svg icons)
// conditionnal infos in popup
// Requirements list for submission
// max img size & img resolution?
// next / prev arrows in popup
// better animations (cubic beziers anims, xbox style)



strapi.start();
github strapi / strapi / packages / strapi-bookshelf / lib / index.js View on Github external
_.forEach(definition.attributes, function (details, name) {
            const verbose = _.get(utilsModels.getNature(details, name), 'verbose') || '';

            // Build associations key
            if (!_.isEmpty(verbose)) {
              utilsModels.defineAssociations(globalName, definition, details, name);
            }

            switch (verbose) {
              case 'hasOne':
                const FK = _.findKey(strapi.models[details.model].attributes, function (details) {
                  if (details.hasOwnProperty('model') && details.model === model && details.hasOwnProperty('via') && details.via === name) {
                    return details;
                  }
                });

                loadedModel[name] = function () {
                  return this.hasOne(global[_.capitalize(details.model)], FK);
                };
                break;

              case 'hasMany':
github strapi / strapi / packages / strapi-bookshelf / lib / index.js View on Github external
_.forEach(definition.attributes, function (details, name) {
            const verbose = _.get(utilsModels.getNature(details, name), 'verbose') || '';

            // Build associations key
            if (!_.isEmpty(verbose)) {
              utilsModels.defineAssociations(globalName, definition, details, name);
            }

            switch (verbose) {
              case 'hasOne':
                const FK = _.findKey(strapi.models[details.model].attributes, function (details) {
                  if (details.hasOwnProperty('model') && details.model === model && details.hasOwnProperty('via') && details.via === name) {
                    return details;
                  }
                });

                loadedModel[name] = function () {
                  return this.hasOne(global[_.capitalize(details.model)], FK);
github strapi / strapi / packages / strapi-hook-bookshelf / lib / utils / graphql.js View on Github external
fetchAll: (collectionIdentity, collection, criteria) => {
    const filters = _.omit(helpers.handleFilters(criteria), value => {
      return _.isUndefined(value) || _.isNumber(value) ? _.isNull(value) : _.isEmpty(value);
    });

    return collection.forge()
      .query(filters)
      .fetchAll({withRelated: helpers.getAssociationsByIdentity(collectionIdentity)})
      .then(data => data.toJSON() || data);
  },
github loteoo / hyperapp-rocks / server.js View on Github external
/**
 * Use `server.js` to run your application without `$ strapi start`.
 * To start the server, run: `$ npm start`.
 *
 * This is handy in situations where the Strapi CLI is not relevant or useful.
 */

const strapi = require('strapi');
strapi.start();
github strapi / strapi-examples / cheesecakes / server.js View on Github external
(() => {
  const strapi = require('strapi');
  strapi.start();
})();
github strapi / strapi-examples / gatsby-strapi-tutorial / api / server.js View on Github external
(() => {
  const strapi = require('strapi');
  strapi.start();
})();

strapi

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: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite

SEE LICENSE IN LICENSE
Latest version published 2 years ago

Package Health Score

41 / 100
Full package analysis