How To Create An Application
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):
Create a client-side application
- Go to the directory of the workspace you want to add the application
mkdir name_of_new_app
cd name_of_new_app
- Run
yo phovea:init-app
and follow the prompts.
Installing
npm install
Building (optional)
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
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:
- Go to the directory of the workspace
myapp_workspace
mkdir myapp
cd myapp
- Run
yo phovea:init-app
and follow the prompts. This initializes a new client app. 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:
mkdir myapp_server
cd myapp_server
- Run
yo phovea:init-slib
and follow the prompts. The promt asks you for your application's name, put inmyapp
. This initializes a new server app. cd ..
Clone and resolve the phovea_server
as follows:
- Run
yo phovea:clone phovea_server
and follow the prompts. 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:
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.
npm install
docker-compose build
Launching
Keep Docker running.
docker-compose up -d
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.