<!-- TITLE: How To Create An Application --> <!-- SUBTITLE: A quick summary of How To Create An Application --> # Create a new application An application is the end point of the Phovea platform implementing an interface for the user. For example, Ordino is an application plugin. ## Prerequisites This tutorial requires you to complete the following steps / tutorials (with links): - [General prerequisites](/phovea/development/workspace/general-prerequisites) - [Create a workspase](/phovea/development/workspace/how-to-create-a-workspace) ## Create a client-side application 1. Go to the directory of the workspace you want to add the application 2. `mkdir name_of_new_app` 3. `cd name_of_new_app` 4. Run `yo phovea:init-app` and follow the prompts. ### Installing ```bash npm install ``` ### Building (optional) ```bash npm run build ``` The build step is optional since it is not required for testing/development. The build process itself includes: * running all unit tests -> karma * checking code quality -> tslint * building the application in production mode (i.e, generates compiled, minified and chunked javascript files that can be loaded using webpack https://webpack.js.org) = ready to be deployed ### Launching ```bash npm start ``` --- ## Create a server-client application Here we assume that you want to create a client side app, called `myapp`, that speaks to a server side app `myapp_server`. The workspace directory is called `myapp_workspace`. Note that plugins must always be lowercase. Create the client side as follows: 1. Go to the directory of the workspace `myapp_workspace` 2. `mkdir myapp` 3. `cd myapp` 4. Run `yo phovea:init-app` and follow the prompts. This initializes a new client app. 5. `cd ..` If you have an existing phovea client side app, you can just clone that repository into this directory. Create the server side as follows: 6. `mkdir myapp_server` 7. `cd myapp_server` 8. Run `yo phovea:init-slib` and follow the prompts. The promt asks you for your application's name, put in `myapp`. This initializes a new server app. 9. `cd ..` Clone and resolve the `phovea_server` as follows: 10. Run `yo phovea:clone phovea_server` and follow the prompts. 11. `yo phovea:workspace` If you are developing against the `develop` branch (which is very likely), you must also switch the repository to the `develop` branch. ### Adding other plugins yo will resolve all dependencies for you. If you, however, want to also edit things like `phovea_core` at the same time, you can just check it out and switch it to the right branch: ```bash yo phovea:clone phovea_core cd phovea_core git checkout develop ``` If you want to change any phovea plugins, you should first create a new feature branch. Don't commit directly to develop or master. ### Installing Keep Docker running. 1. `npm install` 2. `docker-compose build` ### Launching Keep Docker running. 1. `docker-compose up -d` 2. `npm run start:myapp` Now in the browser check adress `http://localhost:8080/` for accessing the app or `http://localhost:8080/api/hello_world/` for accessing the API.