{"id":14016,"library":"simple-odata-server","title":"Simple OData Server","description":"Simple OData Server (simple-odata-server) is a lightweight Node.js library designed to create OData v2 compatible servers with minimal setup. It currently stands at version 1.2.2. While stable and used in projects like jsreport, the repository explicitly states it is no longer actively maintained by its creators, meaning bug fixes and new features are unlikely to be introduced regularly, if at all. Its primary differentiator is its simplicity and direct support for MongoDB and NeDB databases via separate adapter packages (simple-odata-server-mongodb, simple-odata-server-nedb), making it suitable for projects requiring basic OData functionality without the overhead of more comprehensive, feature-rich OData frameworks. It supports core operations like $metadata, filtering, and CRUD operations, but intentionally omits advanced features such as entity links, batch operations, or Atom feeds to maintain its lean footprint.","status":"maintenance","version":"1.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/pofider/node-simple-odata-server","tags":["javascript","OData","server","mongodb","nedb"],"install":[{"cmd":"npm install simple-odata-server","lang":"bash","label":"npm"},{"cmd":"yarn add simple-odata-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-odata-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for using NeDB as a data store, extracted into a separate package since v1.0.0.","package":"simple-odata-server-nedb","optional":false},{"reason":"Required for using MongoDB as a data store, extracted into a separate package since v1.0.0.","package":"simple-odata-server-mongodb","optional":false},{"reason":"A minimal database used directly in the quickstart example for in-memory or file-based storage.","package":"nedb","optional":true}],"imports":[{"note":"The library primarily uses CommonJS `require` syntax. Direct ESM `import` is not officially supported and may lead to issues.","wrong":"import ODataServer from 'simple-odata-server';","symbol":"ODataServer","correct":"const ODataServer = require('simple-odata-server');"},{"note":"Adapters for specific databases like NeDB were extracted into separate packages in v1.0.0 and are imported using CommonJS `require`.","wrong":"import Adapter from 'simple-odata-server-nedb';","symbol":"NedbAdapter","correct":"const Adapter = require('simple-odata-server-nedb');"},{"note":"Similarly, the MongoDB adapter is a separate package imported via CommonJS `require`.","wrong":"import Adapter from 'simple-odata-server-mongodb';","symbol":"MongoDbAdapter","correct":"const Adapter = require('simple-odata-server-mongodb');"}],"quickstart":{"code":"const http = require('http');\nconst Datastore = require('nedb');\nconst db = new Datastore( { inMemoryOnly: true });\nconst ODataServer = require('simple-odata-server');\nconst Adapter = require('simple-odata-server-nedb');\n\nconst model = {\n    namespace: \"jsreport\",\n    entityTypes: {\n        \"UserType\": {\n            \"_id\": {\"type\": \"Edm.String\", key: true},\n            \"name\": {\"type\": \"Edm.String\"}\n        }\n    },\n    entitySets: {\n        \"users\": {\n            entityType: \"jsreport.UserType\"\n        }\n    }\n};\n\nconst odataServer = ODataServer(\"http://localhost:1337\")\n    .model(model)\n    .adapter(Adapter(function(es, cb) { cb(null, db)}));\n\nhttp.createServer(odataServer.handle.bind(odataServer)).listen(1337, () => {\n    console.log('OData server running on http://localhost:1337');\n    console.log('Try: GET http://localhost:1337/$metadata');\n    console.log('Try: POST http://localhost:1337/users with body {\"_id\":\"1\", \"name\":\"Test User\"}');\n    console.log('Try: GET http://localhost:1337/users?$filter=name eq \\'Test User\\''');\n});","lang":"javascript","description":"This quickstart demonstrates setting up a basic OData server using simple-odata-server with an in-memory NeDB database, defining a simple 'UserType' entity and exposing it via an 'users' entity set. It then initializes the server, binds it to an HTTP port, and provides example OData requests."},"warnings":[{"fix":"Install the appropriate adapter package: `npm install simple-odata-server-mongodb` or `npm install simple-odata-server-nedb`.","message":"Starting from v1.0.0, database adapters (MongoDB and NeDB) are no longer bundled with `simple-odata-server`. They must be installed as separate packages (`simple-odata-server-mongodb` or `simple-odata-server-nedb`).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Update your hook implementations to include the `req` parameter: `fn(setName, query, req, cb)` for `query` and `remove`, `fn(setName, doc, req, cb)` for `insert`, and `fn(setName, query, update, req, cb)` for `update`.","message":"The `update`, `query`, `insert`, and `remove` hooks in v1.0.0 changed their signature. They now accept the original HTTP request object as a parameter before the callback.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Evaluate forking the repository if active development or specific new features are required, or consider alternative OData implementations for long-term projects requiring active support.","message":"The package explicitly states it is no longer being actively maintained. While it remains stable and used in production, future updates, bug fixes, or security patches are unlikely.","severity":"deprecated","affected_versions":">=1.2.2"},{"fix":"Upgrade to `simple-odata-server@1.2.2` or later to resolve Node.js deprecation warnings related to the OData parser.","message":"Older versions (prior to 1.2.2) might emit Node.js deprecation warnings due to their reliance on `odata-parser`. Version 1.2.2 updated to `@jsreport/odata-parser` to address this.","severity":"gotcha","affected_versions":"<1.2.2"}],"env_vars":null,"search_vec":"'1.2.2':31 'activ':48 'adapt':84 'advanc':129 'atom':138 'basic':102 'batch':135 'bug':54 'compat':21 'comprehens':110 'core':118 'creat':18 'creator':52 'crud':124 'current':27 'databas':81 'design':16 'differenti':70 'direct':75 'entiti':133 'explicit':42 'featur':58,112,130 'feature-rich':111 'feed':139 'filter':122 'fix':55 'footprint':144 'framework':115 'function':104 'intent':127 'introduc':63 'javascript':145 'jsreport':39 'lean':143 'librari':15 'lightweight':13 'like':38,120 'link':134 'longer':47 'maintain':49,141 'make':96 'mean':53 'metadata':121 'minim':24 'mongodb':78,90,148 'nedb':80,95,149 'new':57 'node.js':14 'odata':2,5,9,19,88,93,103,114,146 'omit':128 'oper':119,125,136 'overhead':107 'packag':85 'primari':69 'project':37,100 'regular':64 'repositori':41 'requir':101 'rich':113 'separ':83 'server':3,6,10,22,89,94,147 'setup':25 'simpl':1,4,8,87,92 'simple-odata-serv':7 'simple-odata-server-mongodb':86 'simple-odata-server-nedb':91 'simplic':73 'stabl':33 'stand':28 'state':43 'suitabl':98 'support':76,117 'unlik':60 'use':35 'v2':20 'version':30 'via':82 'without':105","created_at":"2026-04-20T01:57:29.378969+00:00","updated_at":"2026-04-20T01:57:29.378969+00:00","problems":[{"fix":"Ensure the necessary adapter package is installed (`npm install simple-odata-server-nedb`) and imported: `const Adapter = require('simple-odata-server-nedb');` then passed to the server: `.adapter(Adapter(...))`.","cause":"Attempting to use `odataServer.adapter()` without explicitly importing and passing an adapter from `simple-odata-server-nedb` or `simple-odata-server-mongodb`.","error":"TypeError: Adapter is not a function"},{"fix":"Review the hook signature to ensure it matches `(setName, query, req, cb)` for `query`/`remove`, `(setName, doc, req, cb)` for `insert`, or `(setName, query, update, req, cb)` for `update`, and call `cb(err, result)` appropriately.","cause":"This error occurs in custom `query`, `update`, `insert`, or `remove` hooks if the callback function is not correctly passed or invoked, often due to an incorrect signature introduced in v1.0.0.","error":"Error: Unhandled promise rejection: TypeError: cb is not a function"},{"fix":"Upgrade `simple-odata-server` to version 1.2.2 or later to use the updated `@jsreport/odata-parser` dependency.","cause":"Older versions of `simple-odata-server` (pre-1.2.2) explicitly depended on `odata-parser`, which might not be correctly resolved or installed in some environments, or if it was removed due to deprecation. This was often seen with Node.js deprecation warnings.","error":"Error: Cannot find module 'odata-parser'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pofider/node-simple-odata-server","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/simple-odata-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}