{"id":27372700,"url":"https://github.com/pyrite-framework/pyrite-server-validations","last_synced_at":"2025-06-16T10:42:34.569Z","repository":{"id":57332166,"uuid":"106546370","full_name":"pyrite-framework/pyrite-server-validations","owner":"pyrite-framework","description":"pyrite-server validation plugin","archived":false,"fork":false,"pushed_at":"2017-10-18T22:57:28.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T10:14:59.144Z","etag":null,"topics":["pyrite-server","validation"],"latest_commit_sha":null,"homepage":"http://www.pyritejs.org","language":"TypeScript","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/pyrite-framework.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":"2017-10-11T11:39:13.000Z","updated_at":"2017-10-24T13:43:11.000Z","dependencies_parsed_at":"2022-09-13T13:52:27.520Z","dependency_job_id":null,"html_url":"https://github.com/pyrite-framework/pyrite-server-validations","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/pyrite-framework%2Fpyrite-server-validations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-validations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-validations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-validations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrite-framework","download_url":"https://codeload.github.com/pyrite-framework/pyrite-server-validations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695480,"owners_count":21146956,"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":["pyrite-server","validation"],"created_at":"2025-04-13T10:15:02.858Z","updated_at":"2025-04-13T10:15:03.436Z","avatar_url":"https://github.com/pyrite-framework.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyrite-server-validations\n\n- More information about object config in [https://validatejs.org/](https://validatejs.org/)\n\n## Install\n\n- Decorators feature has to be enabled.\n\n```\nnpm install pyrite-server\nnpm install pyrite-server-validations\n```\n\n## Example\n\n### main.js\n\n```typescript\nimport { PyriteServer } from \"pyrite-server\";\nimport { ValidationPlugin } from \"pyrite-server-validations\";\n\nconst server = new PyriteServer({\n  port: 8000,\n  routes: \"/routes\",\n  plugins: [new ValidationPlugin()]\n});\n\nserver.listen(() =\u003e {\n  console.log(\"Server running!\");\n});\n```\n\n### /routes folder:\n  ### users.js\n  \n```typescript\nimport { Route, Post, Body } from \"pyrite-server\";\nimport { Validation } from \"pyrite-server-validations\";\n\nconst createValidation = {\n  username: {\n    format: {\n      pattern: \"[a-z0-9]+\",\n      flags: \"i\",\n      message: \"can only contain a-z and 0-9\"\n    }\n  },\n  password: {\n    presence: true\n  }\n};\n\nconst users = [];\nlet index = 0;\n\n@Route(\"/users\")\nexport class Users {\n\n  @Post(\"/\")\n  @Validation(createValidation)\n  createUser(@Body user) {\n    user.id = index++;\n\n    users.push(user);\n\n    return user;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrite-framework%2Fpyrite-server-validations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrite-framework%2Fpyrite-server-validations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrite-framework%2Fpyrite-server-validations/lists"}