{"id":2153,"date":"2017-06-07T10:45:30","date_gmt":"2017-06-07T10:45:30","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=2153"},"modified":"2018-10-10T17:15:56","modified_gmt":"2018-10-10T17:15:56","slug":"using-lite-server-to-run-an-angular-application","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=2153","title":{"rendered":"Using lite-server to run an angular application"},"content":{"rendered":"<p><a href=\"https:\/\/www.npmjs.com\/package\/lite-server\">lite-server<\/a> is useful when it is desired to serve an application using actual files, in contrast with <em>ng serve <\/em>which serves everything from memory. A comparison follows:-<\/p>\n<h3>ng serve<\/h3>\n<p>This uses <em>webpack<\/em> to build and serve the application entirely from memory. The consequence of this is that any files (such as external configuration files) which are not specifically part of the angular-cli\/webpack bundles\/built by webpack will not be available\/visible when the application is served. Additional script files can be included in the build bundles by adding to the <em>scripts<\/em> property in <em>.angular-cli.json<\/em>, but of course if this is done they are not then external to the build.<\/p>\n<h3>lite-server used in development mode<\/h3>\n<p>Having installed lite-server globally, it can be used in the following way such that file changes are monitored and updated dynamically in the build :-<\/p>\n<p>under linux:-<\/p>\n<blockquote><p>ng build &#8211;watch &amp;&amp; cd dist &amp;&amp; lite-server<\/p><\/blockquote>\n<p>under windows:-<\/p>\n<blockquote><p>ng build &#8211;watch<br \/>\nrem then under a separate command session:-<br \/>\ncd dist<br \/>\nlite-server<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h3>lite-server used in production mode<\/h3>\n<p>This will do a production build with AOT enabled by default:-<\/p>\n<blockquote><p>ng build &#8211;prod<br \/>\ncd dist<br \/>\nlite-server<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>lite-server is useful when it is desired to serve an application using actual files, in contrast with ng serve which serves everything from memory. A comparison follows:- ng serve This uses webpack to build and serve the application entirely from memory. The consequence of this is that any files (such as external configuration files) which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[198],"tags":[199,16],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2153"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2153"}],"version-history":[{"count":3,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2153\/revisions"}],"predecessor-version":[{"id":2156,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2153\/revisions\/2156"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}