{"id":14973988,"url":"https://github.com/andrewjbateman/postgresql-rest-api","last_synced_at":"2025-10-27T05:31:25.815Z","repository":{"id":42879029,"uuid":"256467893","full_name":"AndrewJBateman/postgresql-rest-api","owner":"AndrewJBateman","description":":clipboard: PostgreSQL database used with nodejs and express to create a REST API","archived":false,"fork":false,"pushed_at":"2022-12-12T12:31:46.000Z","size":526,"stargazers_count":7,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T02:41:24.523Z","etag":null,"topics":["crud","databases","express-middleware","nodejs","nodemon","pgsql","postgresql","postgresql-database","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/AndrewJBateman.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":"2020-04-17T10:05:33.000Z","updated_at":"2025-01-08T16:32:47.000Z","dependencies_parsed_at":"2023-01-27T19:15:14.288Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/postgresql-rest-api","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/AndrewJBateman%2Fpostgresql-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpostgresql-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpostgresql-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpostgresql-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/postgresql-rest-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238445830,"owners_count":19473820,"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":["crud","databases","express-middleware","nodejs","nodemon","pgsql","postgresql","postgresql-database","typescript"],"created_at":"2024-09-24T13:49:47.340Z","updated_at":"2025-10-27T05:31:20.494Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"TypeScript","readme":"# :zap: PostgreSQL Rest API\n\n* App using nodejs with express middleware to connect to a PostgreSQL database and make Create, Read, Update \u0026 Delete (CRUD) operations of user data\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/postgresql-rest-api?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/postgresql-rest-api?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/postgresql-rest-api?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/postgresql-rest-api?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [General info](#general-info)\n* [Screenshots](#screenshots)\n* [Technologies](#technologies)\n* [Setup](#setup)\n* [Code Examples](#code-examples)\n* [Features](#features)\n* [Status](#status)\n* [Inspiration](#inspiration)\n* [Licence](#licence)\n* [Contact](#contact)\n\n## :books: General info\n\n* PostgreSQL needs to be installed and running - I started it from my Windows 10 PostgreSQL 12 dropdown option 'SQL shell (psql)'\n* PostgreSQL shell commands: `\\l` list all databases. `\\c database1` connect to database1. `\\dt` inspect tables. `\\d users` see detail of table with name users. `\\q` to quit.\n* Src (source) folder contains raw code in typescript. Dist (distribution) folder will contain minified/concatenated javascript code for production\n\n## :camera: Screenshots\n\n![screen print](./img/postman.png)\n\n## :signal_strength: Technologies\n\n* [tsc --watch command](https://www.typescriptlang.org/docs/handbook/compiler-options.html) used to run local compiler in watch mode\n* [PostgreSQL v12](https://www.postgresql.org/) database\n* [PostgreSQL Installer for Windows](https://www.postgresqltutorial.com/install-postgresql/)\n* [Express.js middleware v4](https://expressjs.com/)\n* [Postman](https://www.postman.com/) to perform CRUD operations on backend database\n\n## :floppy_disk: Setup\n\n* Create PostgreSQL database and add access credentials to your own `src/routes/config.ts` file (see `config.example.ts`)\n* Add a `/dist` folder at same level as `/src` folder\n* Run `npm install` to install dependencies\n* Run `npm run dev` to compile app and connect to server `localhost: 3000`\n* Run `npm run build` to compile app\n\n## :computer: Code Examples\n\n* code to fetch a user from the Postgres database using id\n\n```typescript\nexport const getUserById = async (\n  req: Request,\n  res: Response\n): Promise\u003cResponse\u003e =\u003e {\n  const id = parseInt(req.params.id);\n  const response: QueryResult = await pool.query(\n    \"SELECT * FROM users WHERE id = $1\",\n    [id]\n  );\n  return res.json(response.rows);\n};\n```\n\n## :cool: Features\n\n* PostgreSQL access credentials hidden from GitHub in `config` file\n* Postman used to perform CRUD operations on PostgreSQL database\n\n## :clipboard: Status \u0026 To-do list\n\n* Status: Fully working basic CRUD app\n* To-do: nothing\n\n## :clap: Inspiration\n\n* [Fazt Code: Youtube tutorial in Spanish: Nodejs, PostgreSQL \u0026 Typescript, REST API CRUD](https://www.youtube.com/watch?v=z4BNZfZ1Wq8)\n\n## :file_folder: License\n\n* N/A\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fpostgresql-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fpostgresql-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fpostgresql-rest-api/lists"}