{"id":19910041,"url":"https://github.com/aitoroses/evented.io","last_synced_at":"2025-06-18T07:42:23.097Z","repository":{"id":14282479,"uuid":"16990546","full_name":"aitoroses/evented.io","owner":"aitoroses","description":"Node API/Websocket Framework","archived":false,"fork":false,"pushed_at":"2014-02-19T16:32:11.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T08:29:35.223Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","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/aitoroses.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":"2014-02-19T16:25:46.000Z","updated_at":"2014-02-19T16:32:12.000Z","dependencies_parsed_at":"2022-09-08T00:00:25.422Z","dependency_job_id":null,"html_url":"https://github.com/aitoroses/evented.io","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aitoroses/evented.io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aitoroses%2Fevented.io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aitoroses%2Fevented.io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aitoroses%2Fevented.io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aitoroses%2Fevented.io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aitoroses","download_url":"https://codeload.github.com/aitoroses/evented.io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aitoroses%2Fevented.io/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260513683,"owners_count":23020568,"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-12T21:17:22.259Z","updated_at":"2025-06-18T07:42:18.080Z","avatar_url":"https://github.com/aitoroses.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Evented.IO\n\nEvented.IO is a Node.JS module that provides a structured way of building RESTful API servers in combination with Websockets (Using Socket.IO) writen in CoffeScript.\n\nThe reason why I've created Evented.IO is because I like another framework called MeteorJS, but meteor is a full-stack framework. I needed the flexibility of an express.js server with the ease of use of a MeteorJS Server.\n\nAlso, Evented.IO provides a client-server JavaScript API to work with collections in realtime, in Meteor flavor. The API will result familiar to you even if you have used Firebase.\n\nI wanted to construct AngularJS applications and mobile native applications using those kind of API's and being compleit enough to make whatever you want, having all control over your server.\n\nI've used **deployd** for example, but I don't like the idea of for example, can't login by default using an OAuth provider. You have to figure out how to implement it. Evented.IO is compatible with everything, so you can implement it your way maybe using.... ¿Passport?\n\nThat said, let's provide a little of light over the table.\n\n## How to Install\n\nIn order to instantiate a new server you need to have running an instance of **MongoDB** and another of a **Redis** store\n\n## Configure a new server\n\n\n```\nevented = require 'evented.io'\n\nEvented = evented({port: 5000});\n```\n\n## Models and Controllers\nYou should have 2 folders on your server's root directory:\n\n- 'models' directory\n- 'controllers' directory\n\nCheckout the examples to know how to write new models and controllers to create RESTful routes\n\n### Creating a new model\n\nThis is not the real User model implementation, we need password salting and those things, but this will give you an idea. Default Modules are loaded into ```process.modules```\n\nThis is the default schema for a model.\n\n```\n # Model Structure\n\n mongoose = process.modules.mongoose\n validate = process.modules.validate\n\n animalSchema = mongoose.Schema\n  \n   name:\n      type: String\n      required: true\n      unique: true\n      validate: validate('len', 5, 10)\n\n   kind:\n      type: String\n      required: true\n      enum: ['cat', 'dog']\n\n # Animal model\n module.exports = mongoose.model('Animal', animalSchema);  \n ```\n \n### Creating a new controller\n\n```\n # Animals controller\n\n Animal = process.server.mongodb.models.Animal\n\n getAllAnimals =\n    method: 'get'\n    path: \"/animal\"\n    version: 1 # Here we specify the version http://api.server.com/v1/animals\n    description: 'Get all Animals'\n    docURL: '/AnimalController#GET_ALL_ANIMAL_ACTION' # Documentation URL\n    params:\n    \t# you can specify required or optional fields\n        required: [] \n        optional: []\n        \n    # Also allowed user kinds and roles\n    allowedUserKinds: []\n    roles: []\n    callback: (req, res, completeCall) -\u003e\n\n        Animal\n        .find()\n        .exec (err, animals)-\u003e\n\n            if err\n                return next\n                \t # Send this data structure\n                    httpStatus: 500 # There was an error\n                    metadata: err\n\n            completeCall({animals: animals})\n            \n module.exports = -\u003e\n \t\n \t# Here is where we export our Restfull API's\n \t\n \t[getAllAnimals]\n```\n\n## Custom Databases\n\nTo use custom databases into your server do the next thing:\n\nYour ```node index.js```\n\n```\nEvented = evented({\n  port: 5000,\n  mongo: {\n    host: 'localhost'\n    password: '27017'\n    db: 'testdb'\n    user: ''\n    password: ''\n  },\n  redis: {\n    host: 'localhost'\n    port: '6379'\n    password: ''\n  }\n});\n```\n\n## Configure a new client\n\nYou should use this two scripts in your header\n\n```\n\u003chead\u003e\n\t\u003cscript src=\"socket.io/socket.io.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"evented.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\n# TODO\n\n- Describe API\n- UserCollection documentation\n- Evented API\n- Collections\n- Pub/Sub\n- process new API's (server, redis, mongoDB, etc...)\n- Evented.Collection\n- Evented.Collections\n- Evented.suscribe\n- Evented.publish","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faitoroses%2Fevented.io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faitoroses%2Fevented.io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faitoroses%2Fevented.io/lists"}