{"id":20532539,"url":"https://github.com/slavede/generator-angular-proxy","last_synced_at":"2025-10-18T01:10:05.801Z","repository":{"id":57246416,"uuid":"56162170","full_name":"slavede/generator-angular-proxy","owner":"slavede","description":"Yeoman generator that creates AngularJS project with possibility to write your proxy server and to use remote server as your backend","archived":false,"fork":false,"pushed_at":"2018-06-29T10:57:45.000Z","size":89,"stargazers_count":4,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T16:18:56.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/slavede.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":"2016-04-13T15:05:59.000Z","updated_at":"2018-06-29T10:56:51.000Z","dependencies_parsed_at":"2022-08-24T16:31:47.010Z","dependency_job_id":null,"html_url":"https://github.com/slavede/generator-angular-proxy","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavede%2Fgenerator-angular-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavede%2Fgenerator-angular-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavede%2Fgenerator-angular-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavede%2Fgenerator-angular-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slavede","download_url":"https://codeload.github.com/slavede/generator-angular-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248833325,"owners_count":21168830,"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-16T00:15:26.051Z","updated_at":"2025-10-18T01:10:00.757Z","avatar_url":"https://github.com/slavede.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generator-angular-proxy\nYeoman generator that creates AngularJS project with possibility to write your proxy server and to use remote server as your backend.\n\n### General idea\nIf you are frontend developer with someone else writing the backend, this is the generator for you. Write only frontend code and use remote backend. If you want, you can mock some requests, until backend is ready.\n\nIt also supports Maven build if you want (you will be prompted with a question).\n\n### Usage\n\nInstall `yo`, `gulp-cli`, `bower`, and `generator-angular-proxy`:\n```\nnpm install -g yo gulp-cli bower generator-angular-proxy\n```\n\nMake a new directory, and `cd` into it:\n```\nmkdir my-new-project \u0026\u0026 cd $_\n```\n\nRun `yo angular-proxy` passing an app name:\n```\nyo angular-proxy [app-name]\n```\n\nYou will be prompted with a few questions:\n\n```\nPage title (it will be displayed in tab)? ()\nProject description (it will be set to meta description)? ()\nWhich angular version (1.x version) you want to use? (latest)\nDo you want to use Bootstrap? (Y/n) (Y)\nDo you want to use Bootstrap LESS (it will be compiled into your css, but you will be able to use it's variables)? (Y/n) (Y) // in case you want to inherit/use Bootstrap LESS variables, select yes, otherwise it will use Bootstrap's css and just concatenate with other vendors\nDo you want to use angular-resource? (Y/n) (Y) // installs angular-resource\nDo you want to use angular-cookies? (Y/n) (Y) // installs angular-cookies\nDo you want to use angular-sanitize? (Y/n) (Y) // installs angular-sanitize\nDo you want to use Angular UI Router (https://github.com/angular-ui/ui-router)? (Y/n) (Y) // otherwise, you will have to use AngularJS's native routing\nAre you going to support unit tests? (Y/n) (Y) // it will generate karma.conf.js and test examples\nAre you going to use Maven for packaging? (Y/n) (Y) // in case you select yes, you will get some Maven specific questions which will be used for pom.xml\n\n  Enter groupId:\n  Enter artifactId:\n  Enter name:\n  Enter final name:\n  Enter node version (vX.X.X, https://nodejs.org/en/download/releases/): v5.9.1\n  Enter NPM version (X.X.X, https://github.com/npm/npm/releases): 3.7.0\n```\n## Development\nAfter you answered all the questions it will install NPM and Bower dependencies.\n\nAlso, you will get examples of routing and unit tests inside the core module.\n\n### Modules\n\nApplication should be developed with the modules (separated by the functionality) in mind. Each time you add new module, you will have to create module.js iside the route folder of the module which is responsible for registering it (see core example).\n\nAlso, add that module name into app.js to load it.\n\n### Running your project\n\n#### Development mode\n```\ngulp serve\n```\n\n#### Production mode\n```\ngulp serve:dist\n```\n\n#### Running/writing tests\nTests are using Karma runner and Jasmine assertion library.\n\nYou have got example of the test together with the generated project to see how write the basic test.\n\n```\ngulp test\ngulp test:auto // runs the test and runs the constantly (each time you change file it will re-run the tests)\n```\n\n### Mocking servers\nThere is a server folder delivered together with your frontend project where you can mock routes if you want.\n```\nserver\n----api\n--------testing\n------------index.js\n----config\n--------environment\n--------conf.js\n--------express.js\n```\nThe imporant thing here is conf.js and mocked-routes.js.\n\nInside conf.js you will define where your remote backend will be (targetServer) and on which URL rest is (restApi) and if you want to use mock server, you can define on which port to be started. If you need only remote backend, just comment mockServer part.\n```\n// conf.js\n\n// where real server will be\nexports.targetServer = {\n    ip : 'http://127.0.0.1',\n    port : 3000,\n    restApi : '/api' // used only in case ONLY targetServer is present (otherwise, mock server will put entire request through)\n}\n\n// where mocked server will be\n// if you want to go directly to server each time, comment out below\nexports.mockServer = {\n    port : 3002,\n    ip : '0.0.0.0',\n    restApi : '/api'\n}\n\n```\n\nInside mocked-routes.js you just have to list files which you want to load to behave as your mocked routes:\n\n```\nmodule.exports = function(app) {\n    require('./api/testing')(app);\n};\n```\n\nThere is an example inside api/testing/index.js how to mock some of the routes.\n\n#### Using only mock server\nYou can develop your frontend without any backend.\n\ne.g. perspective of frontend developer\n\nBackend hasn't start development yet, but you already agreed on some API so let's mock that API.\n\n![mock_only](https://user-images.githubusercontent.com/2838038/42088979-c7fafd48-7b9b-11e8-91dc-d772c64b1afc.png)\n\n```\n/server/config/conf.js\n\n// where mocked server will be\nexports.mockServer = {\n    port : 3002,\n    ip : '0.0.0.0',\n    restApi : '/api'\n}\n\n\n```\n\n#### Using only target server\nYou can develop your frontend by just using your frontend project and using remote backend.\n\ne.g. perspective of frontend developer:\n\nI have only frontend to develop, I don't have to mock and API endpoint and I have backend developer developing for me HTTP endpoint on his own (remote) machine. We agreed on API to be on /api endpoint\n\n![target_only](https://user-images.githubusercontent.com/2838038/42088977-c7b46270-7b9b-11e8-861b-5fd4ec3a9e4c.png)\n\n```\n/server/config/conf.js\n\n// where real server will be\nexports.targetServer = {\n    ip : 'http://www.outside.com,\n    port : '',\n    restApi : '/api'\n}\n\n```\n\n#### Using mock and target server\nYou can develop your frontend by just using your frontend project and using remote backend, but in case remote backend is still missing some API you can write it inside your project.\n\ne.g. perspective of frontend developer\nI realized my backend developer will need more time to develop some feature so I'll quickly mock one API endpoint (/api/mockedUrl).\n\n![both](https://user-images.githubusercontent.com/2838038/42088978-c7e1249a-7b9b-11e8-8fee-6b8d510f3993.png)\n\n```\n/server/config/conf.js\n\n// where real server will be\nexports.targetServer = {\n    ip : 'http://www.outside.com,\n    port : '',\n    restApi : '/api'\n}\n\n// where mocked server will be\nexports.mockServer = {\n    port : 3002,\n    ip : '0.0.0.0',\n    restApi : '/api'\n}\n```\n\n```\nmocked-routes.js\n\nmodule.exports = function(app) {\n    require('./api/mockmodule')(app);\n};\n```\n\n```\n/api/mockmodule.js\n\nmodule.exports = function(app) {\n    app.get('/api/mockedUrl', function(req, res) {\n        res.json({ items: [\n            {\n                id : 1,\n                item : 'Item 1'\n            },\n            {\n                id : 2,\n                item : 'Item 2'\n            }\n        ] });\n    });\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavede%2Fgenerator-angular-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslavede%2Fgenerator-angular-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavede%2Fgenerator-angular-proxy/lists"}