{"id":20139290,"url":"https://github.com/harryho/exprest-mongo-mysql-psql","last_synced_at":"2026-04-07T16:32:33.571Z","repository":{"id":85760613,"uuid":"131718724","full_name":"harryho/exprest-mongo-mysql-psql","owner":"harryho","description":"Express REST API demo with MongoDB, MySql, PostgreSQL","archived":false,"fork":false,"pushed_at":"2018-06-01T00:51:03.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T23:16:59.048Z","etag":null,"topics":["express","mongodb","mysql","psql","rest-api"],"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/harryho.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":"2018-05-01T13:53:07.000Z","updated_at":"2019-01-07T07:50:29.000Z","dependencies_parsed_at":"2023-03-05T05:45:20.977Z","dependency_job_id":null,"html_url":"https://github.com/harryho/exprest-mongo-mysql-psql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harryho/exprest-mongo-mysql-psql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fexprest-mongo-mysql-psql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fexprest-mongo-mysql-psql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fexprest-mongo-mysql-psql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fexprest-mongo-mysql-psql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harryho","download_url":"https://codeload.github.com/harryho/exprest-mongo-mysql-psql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fexprest-mongo-mysql-psql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31520529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["express","mongodb","mysql","psql","rest-api"],"created_at":"2024-11-13T21:44:40.022Z","updated_at":"2026-04-07T16:32:33.527Z","avatar_url":"https://github.com/harryho.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Express REST API demo with MongoDB, MySql, PostgreSQL\n\n\n\u003e This demo app is developed on Ubuntu 16 \n\n### Prerequisite \n\n* Install MonogoDB, MySql, PostgreSQL\n* Install NodeJs, ExpressJs\n\n\n### Install PostgresQL\n\n* psql is case sensitive\n\n```\necho 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' \u003e\u003e /etc/apt/sources.list.d/pgdg.list\nwget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -\n\nsudo apt-get update\nsudo apt-get install postgresql-10\n\nsudo su - postgres\npsql -U postgres\n\n# Create a dump databbase\ncurl -L -O http://cl.ly/173L141n3402/download/example.dump\ncreatedb sample\npg_restore --no-owner --dbname sample example.dump\npsql --dbname sample\n\npsql \n\n# Rename database -- use double quote \nALTER database \"sample\" rename to \"sample\"\n```\n\n* export the database to sql file\n\n```\nsudo su postgres\npg_dump sample \u003e\u003e sample.sql\n```\n\n* export table to csv file\n\n```\nCOPY users to '/home/\u003cyour_name\u003e/db/users.csv' delimiter ',' csv; \n```\n\n* export data to json file\n\n```\nselect json_agg(t) from (select * from users) t \\t on \\pset format unaligned \\g users.json\n```\n\n\n### Install MySql\n\n* Install mysql \n\n```\nwget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.deb\nsudo dpkg -i mysql-apt-config_0.8.9-1_all.deb\nsudo apt-get install mysql-server\nsystemctl status mysql\nmysqladmin -u root -p version\n\nmysql -u root -p mysql\n```\n\n* create a sample table users\n\n```\nCREATE TABLE users (\n    id INT AUTO_INCREMENT NOT NULL,\n    email VARCHAR(255),\n    password VARCHAR(255),\n    details VARCHAR(5000),\n    created_at datetime,\n    deleted_at datetime\n    ,PRIMARY KEY (id)\n);\n\nload data local infile '/home/\u003cyour_name\u003e/db/users.csv' into table users fields terminated by ',' enclosed by '\"' lines terminated by '\\n' (id, title, price, created_at, deleted_at, tags);\n```\n\n\n\n### Install mongodb\n\n```\nsudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5\necho \"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse\" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list\n\nsudo apt-get update\nsudo apt-get install -y mongodb-org\n\nsudo service mongod start\nsudo service mongod stop\nsudo service mongod status\n\n```\n\n* Create a database `sample` and insert one record into document `users`\n\n```\nuse sample\ndb.users.insertOne({id: 1, title: \"Dictionary\", price: 9.99, created_at: \"2011-01-02 07:00:00+11\", tags: \"{Book}\"});\n\ndb.users.find();\n```\n\n* Import json into database\n\n\n```\nmongoimport --db sample --collection users --drop --jsonArray --file ~/db/users.json\n```\n\n\n\n\n###  Install express-generator\n\n```\n npm install express-generator -g\n```\n\n\n## Run \u0026 Test the API\n\n#### Run the API\n\n```\ngit clone https://github.com/harryho/exprest-mongo-mysql-psql\ncd exprest-mongo-mysql-psql\n\n# Install packages with npm or yarn\nnpm i \n\nnpm run\n\n```\n\n### You can run any API you preferred  e.g. MongoDB\n\n**Please make sure MongoDB is running on your OS**\n\n```\n# Check mongod service (Linux: Ubuntu/Debian)\n\nsystemctl status mongod\nnpm run start:mongodb\n\n## You will see following information\n# Server is running on 127.0.0.1:3001, DB:  mongodb\n\n\n# You can use wget, curl or browser to test the URL: http://127.0.0.1:3001/api/v1/users\n\n\n```\n\n### Test API wtih CURL\n\n\n\n```\ncurl -X GET http://127.0.0.1:3001/api/v1/users\n\n# You will see some data as below\n\n...\n\n  { _id: 47,\n    email: 'Harrison.Puett@yahoo.com',\n    password: 'ff9e460aaca39a2c3bbd68043047826a',\n    details: { sex: 'M' },\n    created_at: '2009-07-22T01:20:00+10:00',\n    deleted_at: null },\n  { _id: 48,\n    email: 'Granville.Hedgpeth@gmail.com',\n    password: '87f0bfd98e2a9b8d30bc1309936744cb',\n    details: null,\n    created_at: '2009-08-04T00:54:00+10:00',\n    deleted_at: null },\n...\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryho%2Fexprest-mongo-mysql-psql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryho%2Fexprest-mongo-mysql-psql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryho%2Fexprest-mongo-mysql-psql/lists"}