{"id":18532340,"url":"https://github.com/triptyk/json-api-server-etablissements","last_synced_at":"2025-10-29T16:22:00.935Z","repository":{"id":96529687,"uuid":"242674566","full_name":"TRIPTYK/json-api-server-etablissements","owner":"TRIPTYK","description":null,"archived":false,"fork":false,"pushed_at":"2020-02-24T10:04:19.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-06T12:59:14.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/TRIPTYK.png","metadata":{"files":{"readme":"README.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,"zenodo":null}},"created_at":"2020-02-24T07:38:42.000Z","updated_at":"2021-05-11T08:47:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa7d14c6-0611-4d37-a46d-dfd5c428dfb2","html_url":"https://github.com/TRIPTYK/json-api-server-etablissements","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TRIPTYK/json-api-server-etablissements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TRIPTYK%2Fjson-api-server-etablissements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TRIPTYK%2Fjson-api-server-etablissements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TRIPTYK%2Fjson-api-server-etablissements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TRIPTYK%2Fjson-api-server-etablissements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TRIPTYK","download_url":"https://codeload.github.com/TRIPTYK/json-api-server-etablissements/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TRIPTYK%2Fjson-api-server-etablissements/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264545017,"owners_count":23625387,"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":[],"created_at":"2024-11-06T19:05:59.793Z","updated_at":"2025-10-29T16:22:00.871Z","avatar_url":"https://github.com/TRIPTYK.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ETABLISSEMENTS TEST\n\n## Setup \n\n-\u003e install typescript globally\n\n`yarn global typescript` OR `npm install typescript -g`\n\n-\u003e install dependencies\n\n`yarn install` OR `npm install`\n\n## Run\n\n`tsc \u0026\u0026 node ./dist/index.js`\n\n## JSON models \n\nYou can provide json models that will be be automatically loaded into the fake database\n    \n```json\n{\n  \"projects\": [\n    {\n      \"id\": \"1\",\n      \"title\": \"Project One\",\n      \"details\": \"This is a sample project\",\n      \"percentComplete\": 20,\n      \"approved\": false,\n      \"startDate\": null,\n      \"targetDate\": null,\n      \"completionDate\": null,\n      \"customers#creator\": \"1\",\n      \"customers#customers\": [\n        \"1\",\n        \"2\"\n      ]\n    },\n    {\n      \"id\": \"2\",\n      \"title\": \"Project Two\",\n      \"details\": \"This is a sample project\",\n      \"percentComplete\": 40,\n      \"approved\": false,\n      \"startDate\": null,\n      \"targetDate\": null,\n      \"completionDate\": null,\n      \"customers#creator\": \"2\",\n      \"customers#customers\": [\n        \"1\",\n        \"2\"\n      ]\n    },\n    {\n      \"id\": \"3\",\n      \"title\": \"Project Three\",\n      \"details\": \"This is a sample project\",\n      \"percentComplete\": 60,\n      \"approved\": false,\n      \"startDate\": null,\n      \"targetDate\": null,\n      \"completionDate\": null,\n      \"customers#creator\": \"3\",\n      \"customers#customers\": [\n        \"1\",\n        \"2\"\n      ]\n    }\n  ]\n}\n```\n\n### Relations\n\nRelations are recognized this way : `\"\u003centityType\u003e#\u003crelationName\u003e\": \"\u003cid\u003e\",`\n\n```json\n    \"customers#creator\": \"3\",\n```\n\nThe id can also be an array of ids : \n\n```json\n    \"customers#creators\": [\"3\",\"2\",\"1\"],\n```\n\n:note: : the IDs MUST exist otherwise it will throw errors on startup\n\n#### Relations are created two ways :\n\n```json\n    \"customers#creators\": [\"3\",\"1\"]\n```\n\nif your relation is in a projects.json file , customers will create a projectsCreators relationship on the projects entity side.\n\n#### Notes  \n\n- Only one to one , one to many and many to one are supported at the moment.\n- Querying deeper than first level relations is also WIP.\n\n## JSON-API\n\n### Supported features : \n\n- includes (1 level)\n- pagination\n- sorting\n- sparse fieldsets\n- filters\n    - eq : \\\u003cvalue\\\u003e\n    - noteq : \\\u003cvalue\\\u003e\n\n- creating entity\n- updating entity\n- deleting entity \n\n## Configuration\n\nYou can create a configuration file in config/configuration.json with these values , it will override the default configuration\n\n```json\n{\n    \"pluralizeSerializers\": false,\n    \"authEntity\": \"users\",\n    \"convertCase\": \"kebab-case\",\n    \"unconvertCase\": \"kebab-case\",\n    \"port\":8000,\n    \"jwtAuthKey\":\"patate\",\n    \"jwtExpiration\":2\n}\n```\n\n## Example\n\n```ts\n  import { JsonApiServer, Configuration } from \"@triptyk/jsonapi-server\";\n  import { Request, Response, NextFunction } from \"express\";\n\n  const server = new JsonApiServer();\n\n  server.Router.use((req,res,next) =\u003e {\n      console.log(\"Hello\");\n      next();\n  });\n\n  server.Router.route(\"/status\") \n      .get((req: Request,res: Response,next: NextFunction) =\u003e {\n          res.sendStatus(200);\n      });\n\n  server.register(\"data/projects.json\");\n  server.register(\"data/customers.json\");\n  server.register(\"data/users.json\");\n\n  server.setupServer().then((app) =\u003e {\n      app.listen(Configuration.configuration.port,() =\u003e {\n          console.log(`Mockup server running on port ${Configuration.configuration.port}`);\n      });\n  });\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftriptyk%2Fjson-api-server-etablissements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftriptyk%2Fjson-api-server-etablissements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftriptyk%2Fjson-api-server-etablissements/lists"}