{"id":19020232,"url":"https://github.com/trailsjs/trailpack-footprints","last_synced_at":"2025-04-23T05:27:35.695Z","repository":{"id":57378833,"uuid":"50372995","full_name":"trailsjs/trailpack-footprints","owner":"trailsjs","description":":package: Footprints Trailpack","archived":false,"fork":false,"pushed_at":"2018-02-17T02:47:57.000Z","size":53,"stargazers_count":6,"open_issues_count":7,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T00:07:54.007Z","etag":null,"topics":["trailpack","trails"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trailsjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-25T18:54:22.000Z","updated_at":"2023-11-03T17:12:10.000Z","dependencies_parsed_at":"2022-09-02T21:21:06.628Z","dependency_job_id":null,"html_url":"https://github.com/trailsjs/trailpack-footprints","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-footprints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-footprints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-footprints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-footprints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailsjs","download_url":"https://codeload.github.com/trailsjs/trailpack-footprints/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250376351,"owners_count":21420322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["trailpack","trails"],"created_at":"2024-11-08T20:16:12.075Z","updated_at":"2025-04-23T05:27:35.664Z","avatar_url":"https://github.com/trailsjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trailpack-footprints\n\n[![Gitter][gitter-image]][gitter-url]\n[![NPM version][npm-image]][npm-url]\n[![Build status][ci-image]][ci-url]\n[![Dependency Status][daviddm-image]][daviddm-url]\n[![Code Climate][codeclimate-image]][codeclimate-url]\n\nFootprints Trailpack. This trailpack provides the footprint interface, which\nother trailpacks such as [trailpack-waterline](https://github.com/trailsjs/trailpack-waterline)\nand [trailpack-knex](https://github.com/trailsjs/trailpack-knex) implement,\nas well as a suite of tests that Footprint implementations should pass.\n\n![Trails Footprints Diagram][diagram-image]\n\n## What are Footprints?\n\nFootprints automatically generate easy-to-use RESTful endpoints for your models.\n\n## Install\n\n```sh\n$ npm install --save trailpack-footprints\n```\n\n## Configure\n\n```js\n// config/main.js\nmodule.exports = {\n  packs: [\n    // ... other trailpacks\n    require('trailpack-footprints')\n  ]\n}\n```\n\n```js\n// config/footprints.js\nmodule.exports = {\n  /**\n   * Generate routes for controller handlers.\n   * You can set controllers to true/false to enable/disable \n   * automatic footprints routes globaly\n   */\n  controllers: {\n               \n     /**\n      * Default methods to accept for routes generated from controller handlers.\n      */\n     method: '*',\n  \n     /**\n      * List of controllers to ignore; that is, do not generate footprint routes\n      * for them.\n      */\n     ignore: [ ]\n   },\n\n  /**\n   * Generate conventional Create, Read, Update, and Delete (CRUD) routes for\n   * each Model.\n   */\n  models: {\n    options: {\n\n      /**\n       * The max number of objects to return by default. Can be overridden in\n       * the request using the ?limit argument.\n       */\n      defaultLimit: 100,\n\n      /**\n       * Subscribe to changes on requested models via WebSocket\n       * (support provided by trailpack-websocket)\n       */\n      watch: false,\n\n      /**\n       * Whether to populate all model associations by default (for \"find\")\n       */\n      populate: true\n    },\n\n    actions: {\n      create: true,\n      find: true,\n      update: true,\n      destroy: true,\n\n      /**\n       * Specify which \"association\" endpoints to activate.\n       */\n      createAssociation: true,\n      findAssociation: true,\n      updateAssociation: true,\n      destroyAssociation: true\n    }\n  },\n\n  /**\n   * Prefix your footprint route paths\n   */\n  prefix: '/api/v1'\n}\n```\n\n## API\n\n### `api.services.FootprintService`\n\nThe purpose of `FootprintService` is to transform and forward queries to the datastore.\n\n#### `create (modelName, values, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `modelName` | Yes | The name of the model to create (in `api.models`) | `User` |\n| `values` | Yes | An object containing the values of the record to create | `{ username: 'admin' }` |\n| `options` | No | Datastore-specific options |\n\n#### `find (modelName, criteria, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `modelName` | Yes | The name of the model to search for (in `api.models`) | `User` |\n| `criteria` | Yes | An object containing the query criteria | `{ username: 'admin' }` |\n| `options` | No | Datastore-specific options |\n\n#### `update (modelName, criteria, values, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `modelName` | Yes | The name of the model to create (in `api.models`) | `User` |\n| `criteria` | Yes | An object containing the query criteria | `{ username: 'admin' }` |\n| `values` | Yes | An object containing the values to update | `{ username: 'tjwebb' }` |\n| `options` | No | Datastore-specific options |\n\n#### `destroy (modelName, criteria, options)`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `modelName` | Yes | The name of the model to create (in `api.models`) | `User` |\n| `criteria` | Yes | An object containing the query criteria | `{ username: 'admin' }` |\n| `values` | Yes | An object containing the values to update | `{ username: 'tjwebb' }` |\n| `options` | No | Datastore-specific options |\n\n#### `createAssociation (parentModelName, parentId, childAttributeName, values, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `parentModelName` | Yes | The name of the parent model | `User`\n| `parentId` | Yes | The id of the parent model | `1`\n| `childAttributeName` | Yes | The name of the attribute to create and associate with the parent | `roles`\n| `values` | Yes | An object containing the values to create | `{ name: 'adminRole' }`\n| `options` | No | Datastore-specific options |\n\n#### `findAssociation (parentModelName, parentId, childAttributeName, criteria, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `parentModelName` | Yes | The name of the parent model | `User`\n| `parentId` | Yes | The id of the parent model | `1`\n| `childAttributeName` | Yes | The name of the attribute to create and associate with the parent | `roles`\n| `criteria` | Yes | An object containing the criteria to search on, or an id | `{ name: 'adminRole' }`\n| `options` | No | Datastore-specific options |\n\n#### `updateAssociation (parentModelName, parentId, childAttributeName, criteria, values, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `parentModelName` | Yes | The name of the parent model | `User`\n| `parentId` | Yes | The id of the parent model | `1`\n| `childAttributeName` | Yes | The name of the attribute to create and associate with the parent | `roles`\n| `criteria` | Yes | An object containing the criteria to search on, or an id | `{ name: 'adminRole' }`\n| `values` | Yes | An object containing the values to update | `{ name: 'adminRole' }`\n| `options` | No | Datastore-specific options |\n\n#### `destroyAssociation (parentModelName, parentId, childAttributeName, criteria, [options])`\n\n| param | required? | description | example |\n|:---|:---|:---|:---|\n| `parentModelName` | Yes | The name of the parent model | `User`\n| `parentId` | Yes | The id of the parent model | `1`\n| `childAttributeName` | Yes | The name of the attribute to destroy and dissociate from the parent | `roles`\n| `criteria` | Yes | An object containing the criteria to search on, or an id | `{ name: 'adminRole' }`\n| `options` | No | Datastore-specific options |\n\n### `api.controllers.FootprintController`\n\nThe purpose of the `FootprintController` is to transform and forward requests to the `FootprintService`.\n\n\n[diagram-image]: http://i.imgur.com/olRxPS8.png\n[npm-image]: https://img.shields.io/npm/v/trailpack-footprints.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/trailpack-footprints\n[ci-image]: https://img.shields.io/travis/trailsjs/trailpack-footprints/master.svg?style=flat-square\n[ci-url]: https://travis-ci.org/trailsjs/trailpack-footprints\n[daviddm-image]: http://img.shields.io/david/trailsjs/trailpack-footprints.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/trailsjs/trailpack-footprints\n[codeclimate-image]: https://img.shields.io/codeclimate/github/trailsjs/trailpack-footprints.svg?style=flat-square\n[codeclimate-url]: https://codeclimate.com/github/trailsjs/trailpack-footprints\n[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square\n[gitter-url]: https://gitter.im/trailsjs/trails\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack-footprints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailsjs%2Ftrailpack-footprints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack-footprints/lists"}