{"id":19176037,"url":"https://github.com/node4good/jest","last_synced_at":"2026-03-01T15:03:26.073Z","repository":{"id":2537972,"uuid":"3515199","full_name":"node4good/jest","owner":"node4good","description":"JavaScriptational State Stasfer","archived":false,"fork":false,"pushed_at":"2015-06-24T01:32:09.000Z","size":684,"stargazers_count":24,"open_issues_count":4,"forks_count":8,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-07T19:11:29.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"jest.empeeric.com","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/node4good.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}},"created_at":"2012-02-22T14:19:09.000Z","updated_at":"2021-05-05T01:35:27.000Z","dependencies_parsed_at":"2022-09-10T01:02:33.304Z","dependency_job_id":null,"html_url":"https://github.com/node4good/jest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/node4good/jest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node4good%2Fjest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node4good%2Fjest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node4good%2Fjest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node4good%2Fjest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node4good","download_url":"https://codeload.github.com/node4good/jest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node4good%2Fjest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29973160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T14:44:57.896Z","status":"ssl_error","status_checked_at":"2026-03-01T14:43:27.662Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-09T10:26:59.786Z","updated_at":"2026-03-01T15:03:26.029Z","avatar_url":"https://github.com/node4good.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Jest\n====\n\n\u003e JavaScriptational State Transfer for node.js with easy generating resource from Mongoose ORM\n\n####  #\n\nintroduction\n------------\nThis module provides Resource base class with:\n\n- Authentication\n- Authorization\n- Pagination\n- Cache\n- Throttling\n- Validation\n- MongooseResource\n- Resources listing\n\nsynopsis\n--------\n```js\nvar express = require('express'),\n    app = express(),\n    Jest = require('jest'),\n    mongoose = require('mongoose'),\n    Schema = mongoose.Schema;\n\nmongoose.connect('mongodb://localhost/app');\n\napp.configure(function () {\n    app.set('port', process.env.PORT || 80);\n    app.use(express.logger('dev'));\n    app.use(express.bodyParser());\n    app.use(express.methodOverride());\n    app.use(app.router);\n});\n```\n\n// create mongoose model\n\n```js\nvar User = mongoose.model('user', new Schema({\n    username: {type: String, required: true},\n    email: String,\n    password: {type: String, validate: [function(v) { return true}, 'custom validate']},\n    credits: {type: Number, min: 1, max: 230},\n    role: {type: String, 'default': 'user' ,enum: ['user', 'admin']},\n    date: {type:Date, 'default': Date.now},\n    groups: [{name:String, permissions: [{name:String, expires:Date}]}]\n}));\n```\n\n// create mongoose resource for User model\n\n```js\nvar UserResource = Jest.MongooseResource.extend({\n    init: function(){\n        // call Jest.Resource constructor\n        // passing the Model User we created\n        this._super(User);\n\n        // use array to decide which fields will be visible by API\n        // this.fields = ['username','credits'];\n        // use tree object to decide recursively which fields to expose\n        this.fields = {username: true, credits: true, groups: {name: true, permissions: {name: true} }};\n\n        // use list or\n        this.update_fields = ['email', 'password'];\n\n        // specify base query for the model\n        this.default_query = function(query){\n            return query.where('credits').gte(10);\n        };\n\n        // specify which fields can be used to filter\n        this.filtering = {credits: true};\n\n        // which http methods are allowed\n        this.allowed_methods = ['get', 'post', 'put'];\n    }\n})\n\nvar api = new Jest.Api('api', app);\n\napi.register('users', new UserResource());\n\napp.listen(app.get('port'), function(){\n    console.log('express started on port %d', app.get('port'));\n})\n```\n\nnow go to `http://localhost/api/` to see the api's and `http://localhost/api/users`\nto work with User model the Jest way.\n\n\ninstallation\n------------\n\n    $ npm install jest\n\ndocumentation\n-------------\n\nThere is none.\nBut there is an example, and a test.\n\nAnd maybe one day will be...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode4good%2Fjest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode4good%2Fjest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode4good%2Fjest/lists"}