|
69 | 69 | 4. Now application is working, don't close the command prompt when app is working (if you want to stop it - press **CTRL+C** to times) |
70 | 70 |
|
71 | 71 | #### 6.2 Running Angular as a Windows Service |
72 | | - |
73 | | - 1. Go to the Angular folder and type **cmd** |
| 72 | + |
| 73 | + 1. Modify svc.js name to have a unique name according to your needs. Default is to leave it as is. |
| 74 | + ```javascript |
| 75 | + var svc = new Service({ |
| 76 | + name: 'eForm angular', |
| 77 | + description: 'eForm angular frontend application', |
| 78 | + script: 'server.js' |
| 79 | + }); |
| 80 | + ``` |
| 81 | + 2. Modify server.js for the port no according to your needs. Default is to leave it as is. |
| 82 | + ```javascript |
| 83 | + const defaultPort = 3000; |
| 84 | + |
| 85 | + // proxy |
| 86 | + var apiProxy = httpProxy.createProxyServer(); |
| 87 | + var apiForwardingUrl = 'http://localhost:5000/'; |
| 88 | + apiProxy.on('error', function(e) { |
| 89 | + console.error('Error:'); |
| 90 | + console.info(e); |
| 91 | + console.log('-------------------------------------'); |
| 92 | + }); |
| 93 | + ``` |
| 94 | + 3. Go to the Angular folder and type **cmd** |
74 | 95 |  |
75 | | - 2. install node-windows with npm, unsing the global flag |
| 96 | + 4. install node-windows with npm, unsing the global flag |
76 | 97 | **npm install -g node-windows** |
77 | | - 3. Then call **npm link node-windows** |
78 | | - 4. If you want to install and start the service, call **npm run winserver-install** |
| 98 | + 5. Then call **npm link node-windows** |
| 99 | + 6. If you want to install and start the service, call **npm run winserver-install** |
79 | 100 |  |
80 | | - 5. Now you application has been started as a Windows Service |
| 101 | + 7. Now you application has been started as a Windows Service |
81 | 102 |  |
82 | | - 6. If you want to stop & uninstall, call **npm run winserver-uninstall** |
| 103 | + 8. If you want to stop & uninstall, call **npm run winserver-uninstall** |
83 | 104 |  |
84 | 105 |
|
85 | 106 |
|
|
0 commit comments