{"id":22800017,"url":"https://github.com/dadi/api-connector-template","last_synced_at":"2025-09-19T11:11:40.058Z","repository":{"id":151392675,"uuid":"108872937","full_name":"dadi/api-connector-template","owner":"dadi","description":"A sample API data connector","archived":false,"fork":false,"pushed_at":"2019-01-28T09:56:37.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T10:33:33.888Z","etag":null,"topics":["api","cms","dadi","dadi-api","headless"],"latest_commit_sha":null,"homepage":"https://dadi.tech/api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dadi.png","metadata":{"files":{"readme":"README-SAMPLE.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-30T15:47:53.000Z","updated_at":"2023-06-29T05:01:52.000Z","dependencies_parsed_at":"2023-07-16T11:31:06.934Z","dependency_job_id":null,"html_url":"https://github.com/dadi/api-connector-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-connector-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-connector-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-connector-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-connector-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadi","download_url":"https://codeload.github.com/dadi/api-connector-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249742964,"owners_count":21319030,"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":["api","cms","dadi","dadi-api","headless"],"created_at":"2024-12-12T07:10:49.179Z","updated_at":"2025-09-19T11:11:34.976Z","avatar_url":"https://github.com/dadi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DADI API Connector Template\n\n## Requirements\n\n* [DADI API](https://www.npmjs.com/package/@dadi/api) Version 3.0.0 or greater\n\n## Usage\n\nTo use this connector with your DADI API installation, you'll need to add it to your API's dependencies:\n\n```bash\n$ cd my-api\n$ npm install --save @dadi/api-filestore\n```\n\n## Tests\n\nRun the tests:\n\n```bash\n$ git clone https://github.com/dadi/api-filestore.git\n$ cd api-filestore\n$ npm test\n```\n\n## Configure\n\n### Configuration Files\n\nConfiguration settings are defined in JSON files within a `/config` directory at the root of your API application. DADI API has provision for multiple configuration files, one for each environment that your API is expected to run under: `development`, `qa` and `production`.\n\nThe naming convention for filestore configuration files follows the format `filestore.\u003cenvironment\u003e.json`\n\nFor example:\n\n```\nfilestore.development.json\nfilestore.qa.json\nfilestore.production.json\n```\n\n### Application Anatomy\n\n```sh\nmy-api/\n  config/            # contains environment-specific\n                     # configuration properties\n    config.development.json\n    config.qa.json\n    config.production.json\n    filestore.development.json\n    filestore.qa.json\n    filestore.production.json\n\n  main.js            # the entry point of the app\n\n  package.json\n\n  workspace/\n    collections/     # collection schema files\n    endpoints/       # custom Javascript endpoints\n\n```\n\n### Configuration\n\n```\n{\n  \"database\": {\n    \"path\": \"path/to/your/database(s)\",\n    \"autosaveInterval\": 1000,\n    \"serializationMethod\": \"pretty\"\n  }\n}\n```\n\nProperty | Description | Default\n:--------|:------------|:-------\npath | The relative or absolute path to where your database files will be stored | none\nautosaveInterval | The interval, in milliseconds, between database writes to disk | 5000 (5 seconds)\nserializationMethod | The format of the database file on disk. `normal` is a condensed version of the JSON, `pretty` is more readable | `normal`\n\n### Querying Collections\n\n#### $eq\n\n```js\n// explicit\n{'Name': { '$eq' : 'Odin' }}\n\n// implicit (assumes equality operator)\n{'Name': 'Odin'}\n```\n\n#### $ne\n\nnot equal test\n\n```js\n{'legs': { '$ne' : 8 }}\n```\n\n#### $regex\n\n```js\n// pass in raw regex\nvar results = coll.find({'Name': { '$regex' : /din/ }});\n\n// or pass in string pattern only\nresults = coll.find({'Name': { '$regex': 'din' }});\n\n// or pass in [pattern, options] string array\nresults = coll.find({'Name': { '$regex': ['din', 'i'] }});\n```\n\nIf using regex operator within a named transform or dynamic view filter, it is best to use the latter two examples since raw regex does not seem to serialize/deserialize well.\n\n#### $in\n\n```js\nvar users = db.addCollection(\"users\");\nusers.insert({ name : 'odin' });\nusers.insert({ name : 'thor' });\nusers.insert({ name : 'svafrlami' });\n\n// match users with name in array set ['odin' or 'thor']\n{ 'name' : { '$in' : ['odin', 'thor'] } }\n```\n\n#### $between\n\n```js\n// match users with count value between 50 and 75\n{ count : { '$between': [50, 75] } }\n```\n\n#### $contains / $containsAny / $containsNone\n\n```js\nvar users = db.addCollection(\"users\");\nusers.insert({ name : 'odin', weapons : ['gungnir', 'draupnir']});\nusers.insert({ name : 'thor', weapons : ['mjolnir']});\nusers.insert({ name : 'svafrlami', weapons : ['tyrfing']});\nusers.insert({ name : 'arngrim', weapons : ['tyrfing']});\n\n// returns 'svafrlami' and 'arngrim' documents\n{ 'weapons' : { '$contains' : 'tyrfing' } }\n\n// returns 'svafrlami', 'arngrim', and 'thor' documents\n{ 'weapons' : { '$containsAny' : ['tyrfing', 'mjolnir'] } }\n\n// returns 'svafrlami' and 'arngrim'\n{ 'weapons' : { '$containsNone' : ['gungnir', 'mjolnir'] } }\n\n```\n\n### Composing Nested Queries\n\n#### $and\nfetch documents matching both sub-expressions\n\n```js\n{\n  '$and': [{\n      'Age' : {\n        '$gt': 30\n      }\n    },{\n      'Name' : 'Thor'\n    }]\n}\n```\n\n#### $or\nfetch documents matching any of the sub-expressions\n\n```js\n{\n  '$or': [{\n      'Age' : {\n        '$gte': '40'\n      }\n    },{\n      'Name' : 'Thor'\n    }]\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fapi-connector-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadi%2Fapi-connector-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fapi-connector-template/lists"}