{"id":13626520,"url":"https://github.com/WillStreeter/ws-node-demo","last_synced_at":"2025-04-16T14:33:53.217Z","repository":{"id":73689715,"uuid":"83819528","full_name":"WillStreeter/ws-node-demo","owner":"WillStreeter","description":"A NodeJs application written in TypeScript using ExpressJs framework to create a RESTful api for User model data stored in MongoDB using Mongoose as an adapter. Using the tsoa tool to facilitate a Swagger UI browser API test portal. ","archived":false,"fork":false,"pushed_at":"2019-04-16T02:13:19.000Z","size":1144,"stargazers_count":34,"open_issues_count":1,"forks_count":19,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-08T16:44:17.819Z","etag":null,"topics":["expressjs","jsonwebtoken","mongodb","mongoose","nodejs","swagger-ui","tsoa","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/WillStreeter.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}},"created_at":"2017-03-03T16:39:28.000Z","updated_at":"2024-08-07T06:51:27.000Z","dependencies_parsed_at":"2023-02-24T01:16:06.608Z","dependency_job_id":null,"html_url":"https://github.com/WillStreeter/ws-node-demo","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/WillStreeter%2Fws-node-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillStreeter%2Fws-node-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillStreeter%2Fws-node-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillStreeter%2Fws-node-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WillStreeter","download_url":"https://codeload.github.com/WillStreeter/ws-node-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249250822,"owners_count":21237961,"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":["expressjs","jsonwebtoken","mongodb","mongoose","nodejs","swagger-ui","tsoa","typescript"],"created_at":"2024-08-01T21:02:21.361Z","updated_at":"2025-04-16T14:33:52.803Z","avatar_url":"https://github.com/WillStreeter.png","language":"TypeScript","readme":"# ws-node-demo\n#### A NodeJs application written in TypeScript using ExpressJs, Mongoose, and tsoa to stand up the Swagger UI.\n\n## Prominent Libraries used:\n- [Express](https://expressjs.com)\n- [mongoose](http://mongoosejs.com/)\n- [JWT](https://github.com/auth0/node-jsonwebtoken)\n- [tsoa](https://github.com/lukeautry/tsoa)\n\n## Architecture:\nThe article [Swagger, NodeJS, \u0026 TypeScript : TSOA](https://medium.com/@will.streeter/swagger-nodejs-typescript-tsoa-15a3f10fabaf),\nhas a deeper review of how this application is constructed.\nThis back-end application is a part of a larger effort to demonstrate the principals of web development expressed\nin the article [Practical Web Development and Architecture](https://medium.com/@will.streeter/practical-web-development-and-architecture-26a37d04c10f).\nAdvocating the principal **\"a separation of concerns\"**, thin controllers residing in the **\"service-layer\"**\nretain the singular purpose of acting as filters for API request. Controllers exist to support results of data processing\nlogic derived in outside layers of concern.  Maximizing the opportunity for application growth, without extensive refactoring,\nthe processing of business rules  and cross-cutting concerns are placed in the  **\"business-layer\"**, while\ndatabase adapters, formalized data base queries, and services used to abstract those queries are stationed in the **\"data-layer\"**.\nAs much as possible the controllers duties are focused on directing request to outside resources and responding to results from those\nresource with simple conditional logic.\n\nAnother aspect  emphasized in the  [Practical Web Development and Architecture](https://medium.com/@will.streeter/practical-web-development-and-architecture-26a37d04c10f) article\nis the importance of adopting strategies to support optimal output from a development team. To this end\n[tsoa](https://github.com/lukeautry/tsoa), a Swagger UI creation tool, is used to demonstrate an innovative means of\ngenerating an API testing portal and documentation based on a few simple structural requirements. The Swagger scaffolding\nresides in the **\"presentation-layer\"** .\n\n[ws-dev-docker-example](https://github.com/WillStreeter/ws-dev-docker-example) : is the repository used to bundle this\napplication along with three other submodules. Docker compose is used to orchestrate the development of a **FullStack**.\nThose submodules are located in the GitHub repositories listed below.\n\n+ **(this repo)** [ws-node-demo](https://github.com/WillStreeter/ws-node-demo)\n+ [ws-mongo-demo](https://github.com/WillStreeter/ws-mongo-demo)\n+ [ws-nginx-demo](https://github.com/WillStreeter/ws-nginx-demo)\n+ [ws-ngx-login-demo](https://github.com/WillStreeter/ws-ngx-login-demo)\n\nHow these containers are used as a bundle to facilitate a **FullStack** approach for developing with Docker is delineated in the article,\n[Docker is my {I.D.E}](https://medium.com/@will.streeter/docker-is-my-i-d-e-d6dc84cca26d)\n\n**It should be noted that this application is created for the purposes of demonstrating a development paradigm, not as a production\nready seed.**\n\nAlthough the application is best understood as a part of the larger overall effort demonstrated with the\n[ws-dev-docker-example](https://github.com/WillStreeter/ws-dev-docker-example), it can still be cloned and stood up\nwithout the use of the Docker bundle. To use this application as a separate standalone entity, use the\n**[local-client](https://github.com/WillStreeter/ws-node-demo/tree/local-client)** branch.\n\n\n### Ways to construct this application with or without Docker\n\n1. Using the FullStack( **This NodeJs app**, Mongo, NGINX, Angular app ) approach with an integrated Docker environment.\n\n   + Go to the  [ws-dev-docker-example](https://github.com/WillStreeter/ws-dev-docker-example) repo and follow the README.md\n\n\n2. Using Docker to stand up the application with a dependency of Mongo\n\n  ```$\u003e git clone https://github.com/WillStreeter/ws-node-demo.git\n\n     $\u003e git fetch\n\n     $\u003e git checkout origin/serverless\n\n     $\u003e docker-compose up\n\n  ```\n   + [Swagger UI API tester  **http://localhost:8080/docs**](http://localhost:8080/docs)\n\n\n3. BareMetal (Installing libraries and running it on your machine's OS)\n\n   + Install MongoDB on your machine.\n     + [MongoDB OS X Edition](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/)\n     + [MongoDB Windows Edition](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/)\n\n\n  ```$\u003e git clone https://github.com/WillStreeter/ws-node-demo.git\n\n     $\u003e git fetch\n\n     $\u003e git checkout origin/local-client\n\n     $\u003e npm install\n  ```\n\n   Befor running the application, you will need to update the src/data-layer/adapters/MongooseAccess.ts file by switching commented outline\n   21 and 22.\n\n  from\n\n  ```\n   //let connectionString =   config.get('mongo.urlClient').toString();\n    let connectionString = config.get('mongo.urlDocker').toString();\n  ```\n\n  to\n\n  ```\n     let connectionString =   config.get('mongo.urlClient').toString();\n    //let connectionString = config.get('mongo.urlDocker').toString();\n  ```\n\nMaking this change will switch the host from ws-mongo-demo to 127.0.0.1 (localhost). These variables are set in the config/default.yaml\n\n\n  ```\n     $\u003e npm run start\n  ```\n\n   + [Swagger UI API tester  **http://localhost:8080/docs**](http://localhost:8080/docs)\n\n\n\n### Here are some examples of object types to insert an incorrect user and a correct user\n\n  ```incorrect user\n\n    {\n      \"username\": \"tao\",\n      \"password\": \"1234\",\n      \"firstname\": \"zip\",\n      \"lastname\": \"zap\",\n      \"email\": \"zip-zap@ez.com\",\n      \"admin\": false,\n      \"isLoggedIn\": false\n    }\n\n\n    correct user\n    {\n      \"username\": \"taosing\",\n      \"password\": \"password\",\n      \"firstname\": \"fifty\",\n      \"lastname\": \"cents\",\n      \"email\": \"zip-zap@ez.com\",\n      \"admin\": false,\n      \"isLoggedIn\": false\n    }\n  ```\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWillStreeter%2Fws-node-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWillStreeter%2Fws-node-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWillStreeter%2Fws-node-demo/lists"}