= Deploying a sample application with `odo`

You can use [command]`odo` to create {openshift} projects and applications from the command line.
This procedure deploys a sample application to the {ocp} cluster running in the {prod} instance.

.Prerequisites
* You have installed [command]`odo`.
For more information, see link:{odo-docs-url-installing}[Installing `odo`] in the [command]`odo` documentation.
* {prod} is configured to use the {openshift} preset.
For more information, see link:{crc-gsg-url}#changing-the-selected-preset_gsg[Changing the selected preset].
* The {prod} instance is running.
For more information, see link:{crc-gsg-url}#starting-the-instance_gsg[Starting the instance].

.Procedure
. Log in to the running {ocp} cluster managed by {prod} as the `developer` user:
+
[subs="+quotes,attributes"]
----
$ odo login -u developer -p developer
----

. Create a project for your application:
+
[subs="+quotes,attributes"]
----
$ odo project create sample-app
----

. Create a directory for your components:
+
[subs="+quotes,attributes"]
----
$ mkdir sample-app
$ cd sample-app
----

. Clone an example Node.js application:
+
[subs="+quotes,attributes"]
----
$ git clone https://github.com/openshift/nodejs-ex
$ cd nodejs-ex
----

. Add a `nodejs` component to the application:
+
[subs="+quotes,attributes"]
----
$ odo create nodejs
----

. Create a URL and add an entry to the local configuration file:
+
[subs="+quotes,attributes"]
----
$ odo url create --port 8080
----

. Push the changes:
+
[subs="+quotes,attributes"]
----
$ odo push
----
+
Your component is now deployed to the cluster with an accessible URL.

. List the URLs and check the desired URL for the component:
+
[subs="+quotes,attributes"]
----
$ odo url list
----

. View the deployed application using the generated URL.

.Additional resources
* For more information about using [command]`odo`, see the link:{odo-docs-url}[`odo` documentation].
