5 lines
9.2 KiB
JSON
5 lines
9.2 KiB
JSON
|
{
|
||
|
"id": "start/start-deployment",
|
||
|
"title": "Deploying an application",
|
||
|
"contents": "\n\n\n<div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/aio/content/start/start-deployment.md?message=docs%3A%20describe%20your%20change...\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n</div>\n\n\n<div class=\"content\">\n <h1 id=\"deploying-an-application\">Deploying an application<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"start/start-deployment#deploying-an-application\"><i class=\"material-icons\">link</i></a></h1>\n<p>Deploying your application is the process of compiling, or building, your code and hosting the JavaScript, CSS, and HTML on a web server.</p>\n<p>This section builds on the previous steps in the <a href=\"start\" title=\"Try it: A basic application\">Getting Started</a> tutorial and shows you how to deploy your application.</p>\n<h2 id=\"prerequisites\">Prerequisites<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"start/start-deployment#prerequisites\"><i class=\"material-icons\">link</i></a></h2>\n<p>A best practice is to run your project locally before you deploy it. To run your project locally, you need the following installed on your computer:</p>\n<ul>\n<li>\n<p><a href=\"https://nodejs.org/en/\">Node.js</a>.</p>\n</li>\n<li>\n<p>The <a href=\"https://cli.angular.io/\">Angular CLI</a>.\nFrom the terminal, install the Angular CLI globally with:</p>\n<code-example language=\"sh\">\nnpm install -g @angular/cli\n</code-example>\n<p> With the Angular CLI, you can use the command <code>ng</code> to create new workspaces, new projects, serve your application during development, or produce builds to share or distribute.</p>\n</li>\n</ul>\n<h2 id=\"running-your-application-locally\">Running your application locally<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"start/start-deployment#running-your-application-locally\"><i class=\"material-icons\">link</i></a></h2>\n<ol>\n<li>\n<p>Download the source code from your StackBlitz project by clicking the <code>Download Project</code> icon in the left menu, across from <code>Project</code>, to download your files.</p>\n</li>\n<li>\n<p>Create a new Angular CLI workspace using the <a href=\"cli/new\" title=\"CLI ng new command reference\"><code>ng new</code></a> command, where <code>my-project-name</code> is what you would like to call your project:</p>\n<code-example language=\"sh\">\nng new my-project-name\n</code-example>\n<p>This command displays a series of configuration prompts. For this tutorial, accept the default settings for each prompt.</p>\n</li>\n<li>\n<p>In your newly CLI-generated application, replace the <code>/src</code> folder with the <code>/src</code> folder from your <code>StackBlitz</code> download.</p>\n</li>\n<li>\n<p>Use the following CLI command to run your application locally:</p>\n<code-example language=\"sh\">\nng serve\n</code-example>\n</li>\n<li>\n<p>To see your application in the browser, go to <a href=\"http://localhost:4200/\">http://localhost:4200/</a>.\nIf the default port 4200 is not available, you can specify another port with the port flag as in the following example:</p>\n<code-example language=\"sh\">\nng serve --port 4201\n</code-example>\n<p>While serving your application, you can edit your code and see the changes update automatically in the browser.\nTo stop the <code>ng serve</code> command, press <code>Ctrl</code>+<code>c</code>.</p>\n</li>\n</ol>\n<a id=\"building\"></a>\n<h2 id=\"building-and-hosting-your-application\">Building and hosting your application<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"start/start-deployment#building-and-hosting-your-application\"><i class=\"material-icons\">link</i></a></h2>\n<ol>\n<li>\n<p>To build your application for production, use the <code>build</code> command. By default, this command uses the <code>production</code> build configuration.</p>\n<code-example language=\"sh\">\nng build\n<
|
||
|
}
|