{"id":20494083,"url":"https://github.com/jaystack/odata-v4-server-pgsql-example","last_synced_at":"2025-04-13T17:21:27.090Z","repository":{"id":146253369,"uuid":"74745268","full_name":"jaystack/odata-v4-server-pgsql-example","owner":"jaystack","description":"Postgres example for odata-v4-server","archived":false,"fork":false,"pushed_at":"2017-06-13T04:29:36.000Z","size":36,"stargazers_count":10,"open_issues_count":5,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-27T08:11:22.524Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jaystack.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-25T09:41:56.000Z","updated_at":"2024-11-15T22:54:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"68be4852-4696-41c7-bd3b-7e8d03680d40","html_url":"https://github.com/jaystack/odata-v4-server-pgsql-example","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/jaystack%2Fodata-v4-server-pgsql-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-server-pgsql-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-server-pgsql-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-server-pgsql-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaystack","download_url":"https://codeload.github.com/jaystack/odata-v4-server-pgsql-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750848,"owners_count":21155794,"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-15T17:38:08.466Z","updated_at":"2025-04-13T17:21:27.084Z","avatar_url":"https://github.com/jaystack.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# odata-v4-server-pgsql-example\nPostgreSQL Server example for **[JayStack OData V4 Server](https://github.com/jaystack/odata-v4-server)**\n\n## About JayStack OData V4 Server (odata-v4-server)\n\nWith JayStack OData v4 Server you can build your own data endpoints without the hassle of implementing any protocol-level code. This framework binds OData v4 requests to your annotated controller functions, and compiles OData v4 compatible response. Clients can access services through OData-compliant HTTP requests. We recommend the JayData library for consuming OData v4 APIs.\n\nThis example uses **JayStack OData V4 Server [(odata-v4-server)](https://github.com/jaystack/odata-v4-server)** and [odata-v4-pgsql](https://github.com/jaystack/odata-v4-pgsql) repositories.\n\nYou can read more about **JayStack OData V4 Server** in our tutorial at ...\n\nAlso there are sevaral other examples on **JayStack OData V4 Server (odata-v4-server)**:\n- [client example using React](https://github.com/jaystack/odata-v4-server-react-client-example)\n- [server example using MySql](https://github.com/jaystack/odata-v4-mysql-example)\n- [server example using MSSql](https://github.com/jaystack/odata-v4-server-mssql-example)\n- [server example using MongoDb](https://github.com/jaystack/odata-v4-server-mongodb-example)\n\n## Technical details of this example\n### Setting up the database\nYou have to create the database manually using this command after connecting to the default database:\n```SQL\nCREATE DATABASE northwind;\n```\n\n### Setting up the connection\nYou may customize the db connection options\nby editing [connect.ts](https://github.com/jaystack/odata-v4-server-pgsql-example/blob/master/src/utils/connect.ts#L29-L30).\nBy default, these are the options:\n```js\nconst pool = new pg.Pool({\n  user: 'postgres',\n  password: 'postgres',\n  database: 'northwind'\n});\n```\nBy default, the database will listen on `port` `5432` therefore it is not set above.\n\n### Building the application\n```\nnpm run build\n```\n\n### Testing the application\n```\nnpm test\n```\n\n### Starting the application\n```\nnpm start\n```\n\n### Creating sample data\nAfter starting the application (it will listen on `localhost:3000` by default) you can generate / recreate the sample dataset\nby submitting [localhost:3000/initDb](http://localhost:3000/initDb).\nAlternatively if you start unit tests (`npm test`) then the database will be initialized automatically.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaystack%2Fodata-v4-server-pgsql-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaystack%2Fodata-v4-server-pgsql-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaystack%2Fodata-v4-server-pgsql-example/lists"}