{"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.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install simple-odata-server"],"cli":null},"imports":["const ODataServer = require('simple-odata-server');","const Adapter = require('simple-odata-server-nedb');","const Adapter = require('simple-odata-server-mongodb');"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}