{"id":21456003,"url":"https://github.com/imhazige/node-examples","last_synced_at":"2026-04-28T12:02:26.537Z","repository":{"id":39917010,"uuid":"122567706","full_name":"imhazige/node-examples","owner":"imhazige","description":"examples of the nodejs","archived":false,"fork":false,"pushed_at":"2023-01-12T11:37:12.000Z","size":10581,"stargazers_count":1,"open_issues_count":116,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T00:56:42.820Z","etag":null,"topics":["examples","meteor","nodejs","nuxt","websocket"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imhazige.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-23T03:17:51.000Z","updated_at":"2021-03-08T20:49:57.000Z","dependencies_parsed_at":"2023-02-09T11:30:43.584Z","dependency_job_id":null,"html_url":"https://github.com/imhazige/node-examples","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/imhazige/node-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imhazige%2Fnode-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imhazige%2Fnode-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imhazige%2Fnode-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imhazige%2Fnode-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imhazige","download_url":"https://codeload.github.com/imhazige/node-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imhazige%2Fnode-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"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":["examples","meteor","nodejs","nuxt","websocket"],"created_at":"2024-11-23T05:14:13.725Z","updated_at":"2026-04-28T12:02:26.512Z","avatar_url":"https://github.com/imhazige.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Examples for Node.js\n\n## [Websocket Example](./websocket)\n\nthis example use three type of websocket server implementation\n\nsocket.io and sockjs are all implements a weird, arbitrary layer over the WebSocket protocol, which need server side support.\n\n### Server:\n\nsockjs https://github.com/sockjs/sockjs-node  \nraw websocket server https://github.com/websockets/ws  \nsocket.io https://github.com/socketio/socket.io (did not work, no error, no request if use path option, the api is not good)\n\n### Client(Node.js)\n\nhttps://github.com/websockets/ws  \nServer connect to [Echo test](ws://echo.websocket.org) see http://websocket.org/echo.html\n\n### Client(Browser):\n\nHTML5 https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/dev-guides/hh673567(v=vs.85)\nhttps://github.com/sockjs/sockjs-client  \nhttps://github.com/socketio/socket.io-client (the path option did not work)\n\nhttps://stackoverflow.com/questions/5510537/websocket-library-for-browsers\n\n### Client:\n\n#### develop:\n\nuse proxy to access express server  \nproxy also work with websocket protocol\n\n### How To Run\n\n#### Server\n\n```shell\nnpm run dev\n```\n\n#### Client\n\n```shell\ncd src/client\nnpm start\n```\n\n## [Nuxt with Expressjs](./nuxt_express)\n\nServer side rendering by [nuxt.js](https://github.com/nuxt/nuxt.js) associating with expressjs  \nusing [AdminLTE](https://github.com/almasaeed2010/AdminLTE/) which depend on [bootstrap@3](https://getbootstrap.com/) and [jquery](https://jquery.com/)  \ncreate with template[express-template](https://github.com/nuxt-community/express-template)  \nit works much better than next.js and have better document for now. But..., still a tentative way to me. Have not much confidence to use it in real production.\n\n### problems:\n\n- the eslint --fix did not fix the error, so I ignore all the source in the .eslintignore\n\n### how to run\n\ngo the folder, run `npm install` then run `npm run dev`\n![](./nuxt-admin-lte.png)\n\n## [Next.js with Expressjs](./nextjs_express)\n\nServer side rendering by [next.js](https://github.com/zeit/next.js) associating with expressjs  \nusing [AdminLTE](https://github.com/almasaeed2010/AdminLTE/)\n\n### The Problem\n\nI have the problem as same as [nextjs custom server build size is too big\n](https://stackoverflow.com/questions/48572022/nextjs-custom-server-build-size-is-too-big)\n\n- after `npm build`, then `npm start` which with NODE_ENV = production, the main.js is still 1.2M, and there are hot reloading, it seems the production env did not work.\n- there are not much resource to find the answer to resolve the problem.\n\nso for now, I will not update the example until there are more progress of the popularity of the next.\n\n## [Meteor Examples](./meteor)\n\n### How to run\n\nplease see the shell [run-dev.sh](./meteor/run-dev.sh), change the environment variable in the shell then run from the meteor project folder\n`bash ./run-dev.sh`\n\n### Collections and pub/sub methods\n\n#### [pubsub1](./meteor/imports/pubsub1/client/pubsub1.js)\n\nsubscribe to mongolist, render with react and Tracker.autorun.  \nuse methods to update.\n\n#### [pubsub2](./meteor/imports/pubsub2/client/pubsub2.js)\n\nsubscribe to mongolist, render with withtrack.  \nuse methods to update.\n\n#### [pubsub3](./meteor/imports/pubsub3/client/pubsub3.js)\n\nsubscribe to customer collection, which actually is a local collection\n\n### UI and theme\n\n#### [login](./meteor/imports/ui/account1/login.js)\n\nshow how to use meteor accounts-password to login\n\n#### [newuser](./meteor/imports/ui/account1/newuser.js)\n\nshow how to use meteor accounts-password to create a new user by email and password\n\n#### [transaction](./meteor/imports/transaction1/client/transaction1.js)\n\nshow how use mongo dirver 3.1 api to do transaction, it will make the publication know the change, but there will be an obviously time gap and the meteor native collection will not affected by the transaction as they are in another database connection.\nNOTE:as transaction only work in a [replica set(mongo 4.0)](https://docs.mongodb.com/manual/tutorial/deploy-replica-set/). so will have error like [Transaction numbers are only allowed on a replica set member](https://stackoverflow.com/questions/51461952/mongodb-v4-0-transaction-mongoerror-transaction-numbers-are-only-allowed-on-a) when you run in local machine with one mongo node.\n\n#### [dashboard](./meteor/imports/ui/dashboard/main.js)\n\nshow how to apply theme layout of [Material Dashboard](https://demos.creative-tim.com/material-dashboard/docs/2.0/getting-started/introduction.html#docs),\nalso show do logout of the account\n\n### Conclusion\n\ntried local collection without mongodb, it will not publish the change across the connections as each collection\nis a local collection.\n\nSo, use mongodb if you using meteor, otherwise, most feature dispear!!!\n\n### problems:\n\n#### func is not a function\n\nsee https://github.com/aldeed/meteor-collection2-core/issues/30,\njust remove aldeed:simple-schema from .meteor/packages and .meteor/versions\nand import:  \n`import SimpleSchema from 'simpl-schema';` instead\n\n## [Miscellaneous Examples](./misc_examples)\n\n### Recursion Solution - Trampoline\nrefer to [this article](https://dev.to/pichardoj/do-you-even-recurse-and-if-you-do-do-you-do-it-safely-4mef)\n\nI add a promise case.\n\n#### Run\ngo into folder `es6-examples`\n\n```shell\nnpm i\nnpm start ./trampoline/recursion-single.js \n```\n\n\n### module cycle require\n\nrefer to this article [ES modules: A cartoon deep-dive](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/)  \n![](https://2r4s9p1yi1fa2jd7j43zph8r-wpengine.netdna-ssl.com/files/2018/03/43_cjs_cycle.png)\nbut we should not mess our code up like such a require relation.\n\n#### Run:\n\ngo into folder misc_examples\\src\\module_cycle_require\n\n```shell\nnode .\\m_a.js\n```\n\n### Nodejs [Brotli Compression](https://nodejs.org/api/zlib.html#zlib_class_brotlioptions)\n\nThis require [conda](https://conda.io/en/master/miniconda.html) to use nodejs11\n\n#### Prepare Environment\n\n`conda create -n nodejs11`\n`conda activate nodejs11`\n`conda install -c conda-forge nodejs`\n\n#### Run\n\ngo into folder misc_examples\\src\\nodejs11\n\n```shell\nconda activate nodejs11\nnode .\\brotli.js\n```\n\n## [Similar Implementation of React Hooks](./react-hooks-implementation)\n\nInspired by [10 lines implemention of hooks](https://twitter.com/swyx/status/1100833207451185152)\n\nA implementation of Reat Hooks\n\nAlso include [implementation of Redux](https://repl.it/@dericgw/ReduxRecreated)\n\n### Run\n\n`npm install`  \n`npm test`\n\n## [Graphql Apollo Subscriptions with Vue](./apollo-graphql-subscription-vue)\n\ninspired by https://github.com/Akryum/apollo-server-example\n\ninspired by https://github.com/Akryum/vue-apollo-example\n\n\n## [Graphql - Prisma Nusus](./apollo-fullstack)\ncopy from https://github.com/prisma-labs/nexus\n\n## [Graphql - Prisma2 with Apollo](./prisma2-graphql-apollo-server)\n\ncopy from https://github.com/prisma/prisma-examples\n\n\n## [React Native - Alita](./reactnative-alita-todo)\n\ncopy from https://github.com/areslabs/alita","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimhazige%2Fnode-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimhazige%2Fnode-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimhazige%2Fnode-examples/lists"}