{"id":18578459,"url":"https://github.com/yasaricli/tatsy","last_synced_at":"2025-04-10T10:31:11.061Z","repository":{"id":44048373,"uuid":"219527926","full_name":"yasaricli/tatsy","owner":"yasaricli","description":"A simple interface for creating REST APIs","archived":false,"fork":false,"pushed_at":"2023-01-05T00:06:54.000Z","size":1247,"stargazers_count":7,"open_issues_count":18,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T19:39:30.325Z","etag":null,"topics":["api","javascript","mongodb","mongoose","rest-api"],"latest_commit_sha":null,"homepage":"","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/yasaricli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-04T15:01:02.000Z","updated_at":"2020-07-03T13:28:22.000Z","dependencies_parsed_at":"2023-02-03T01:16:39.044Z","dependency_job_id":null,"html_url":"https://github.com/yasaricli/tatsy","commit_stats":null,"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaricli%2Ftatsy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaricli%2Ftatsy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaricli%2Ftatsy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaricli%2Ftatsy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasaricli","download_url":"https://codeload.github.com/yasaricli/tatsy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199136,"owners_count":21063641,"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","javascript","mongodb","mongoose","rest-api"],"created_at":"2024-11-06T23:35:34.268Z","updated_at":"2025-04-10T10:31:10.414Z","avatar_url":"https://github.com/yasaricli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"screen.png\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A simple interface for creating REST APIs\n  \u003cbr\u003e\n  \u003ca href=\"https://tatsy.js.org/\"\u003e\u003cstrong\u003eWebsite\u003c/strong\u003e\u003c/a\u003e | \u003ca href=\"https://github.com/tsepeti/tatsy/wiki\"\u003e\u003cstrong\u003eWiki\u003c/strong\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Getting started](#getting-started)\n- [Defining Collection Routes](#defining-collection-routes)\n- [Defining Custom Routes](#defining-custom-routes)\n  - [Defining Endpoints](#defining-endpoints)\n- [Packages](#packages)\n- [Developer Resources](#developer-resources)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Getting started\n\nInstall with yarn:\n\n    yarn add tatsy\n  \nor with npm:\n\n    npm install tatsy\n\nand add a script to your **package.json** like this:\n\n```JSON\n\"scripts\": {\n  \"start\": \"tatsy --start\",\n  \"build\": \"tatsy --build\",\n},\n```\n\nand then just run `yarn start` and go to http://localhost:3000/api\n\n## Defining Collection Routes\nOne of the most common uses for a REST API is exposing a set of operations on your collections.\nAll available REST endpoints can be generated for a Mongo Collection using\n`Tatsy.Collection(name, options)`.\n\n```javascript\n// articles.js | Given a URL \"/articles/5\"\nTatsy.Collection('articles', {\n  schema: {\n    title: String,\n    author: String\n  }\n})\n```\n\n**`/api/\u003ccollection\u003e`**\n- Operations on the entire collection\n-  `GET` and `POST`\n\n**`/api/\u003ccollection\u003e/:id`**\n- Operations on a single entity within the collection\n- `GET`, `PUT`, `PATCH` and `DELETE`\n\n## Defining Custom Routes\nRoutes are defined using `Tatsy.Route()`. A route consists of a path and a set of endpoints\ndefined at that path.\n\nIn this example we have a parameter named `_id`. If we navigate to the `/posts/5` URL in our browser,\ninside of the GET endpoint function we can get the actual value of the `_id` from\n`(_id) { console.log(_id) }`. In this case `_id =\u003e 5`.\n\n```javascript\n// posts.js | Given a URL \"/posts/5\"\nTatsy.Route({\n  endpoints: {\n    get: {\n      authRequired: true, // default false\n      action() {\n        const { _id } = this.urlProps;\n        \n        return {\n          _id\n        }\n      }\n    }\n  }\n});\n```\n\n### Defining Endpoints\n\nThe last parameter of `Tatsy.Route` is an object with properties corresponding to the supported\nHTTP methods. At least one method must have an endpoint defined on it. The following endpoints can\nbe defined in Tatsy:\n- `getAll`\n- `get`\n- `post`\n- `put`\n- `delete`\n\n## Packages\n\nThis repository is a monorepo that we manage using [Lerna](https://github.com/lerna/lerna). That means that we actually publish [several packages](/packages) to npm from the same codebase, including:\n\n| Package                                                | Version                                                                                                                             | Description                                                                         |\n| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |\n| [`tatsy`](/packages/tatsy)                             | [![npm](https://img.shields.io/npm/v/tatsy.svg?style=flat-square)](https://www.npmjs.com/package/tatsy)                             | The core of tatsy                                                                   |\n| [`tatsy-http`](/packages/tatsy-http)                   | [![npm](https://img.shields.io/npm/v/tatsy-http.svg?style=flat-square)](https://www.npmjs.com/package/tatsy-http)                   | Http Server for Express.js                                                          |\n| [`tatsy-collection`](/packages/tatsy-collection)       | [![npm](https://img.shields.io/npm/v/tatsy-collection.svg?style=flat-square)](https://www.npmjs.com/package/tatsy-collection)       | Mongodb collection use mongoose                                                     |\n| [`tatsy-logger`](/packages/tatsy-logger)               | [![npm](https://img.shields.io/npm/v/tatsy-logger.svg?style=flat-square)](https://www.npmjs.com/package/tatsy-logger)               | Log using chalk                                                                     |\n| [`tatsy-config`](/packages/tatsy-config)               | [![npm](https://img.shields.io/npm/v/tatsy-config.svg?style=flat-square)](https://www.npmjs.com/package/tatsy-config)               | Config package                                                                      |\n| [`tatsy-watcher`](/packages/tatsy-watcher)             | [![npm](https://img.shields.io/npm/v/tatsy-watcher.svg?style=flat-square)](https://www.npmjs.com/package/tatsy-watcher)             | package to watch all javascript files                                               |\n## Developer Resources\n\nInterested in helping or contributing to Tatsy?  These resources will help:\n\n* [Core development guide](DEVELOPMENT.md)\n* [Contribution guidelines](CONTRIBUTING.md)\n* [Issue tracker](https://github.com/tsepeti/tatsy/issues)\n\n## License\n\nTatsy is open source software [licensed as MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasaricli%2Ftatsy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasaricli%2Ftatsy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasaricli%2Ftatsy/lists"}