
- #AURELIA HTTP CLIENT EXAMPLE INSTALL#
- #AURELIA HTTP CLIENT EXAMPLE CODE#
- #AURELIA HTTP CLIENT EXAMPLE WINDOWS#
The sample projects after all the changes in this post can be found here.
#AURELIA HTTP CLIENT EXAMPLE CODE#
Hopefully, this was useful even if my Aurelia code might not be idiomatic.

au run -open Wrapping UpĪs always NSwag makes it very easy to create a client to interact with an API. Aurelia is not just a framework, but a powerful platform and ecosystem, designed to ensure your rapid success. CLI, VS Code plugin, and Chrome debugger - optional tools to enhance development. If you drop the open it will run the application without opening a browser. State management, internationalization and validation - all official plugins from the core team. $Īfter all the change from a command prompt set to the root of the Aurelia project, you can use the following command to run the application. We aren’t really going into the Aurelia specific bits, but even if you are new to Aurelia this should be readable. This is a mix of HTML and Aurelia’s syntax. All of the following will be taking place in the src directory of the Aurelia project.įirst, add a file named contact-list.html which will hold the template for the UI of the contact list with the following contents. For example, using a local instance of the sample solution’s Contacts API the URL is If you are using the Swagger UI you can find a link to your swagger.json under the API title.Īgain the UI bit mostly comes from the docs, but I’m going to show the bits for the contact list here and the rest of the UI you can look at the sample code. Next, make sure your API is running and get the URL of its OpenAPI/Swagger specification URL. NSwagStudio can be downloaded and installed from here.
#AURELIA HTTP CLIENT EXAMPLE WINDOWS#
This post is going to use the Windows application which is called NSwagStudio. NSwag provides multiple options for client generation including a CLI, code, or a Windows application. In the recommended setting, aurelia-authentication makes use of aurelia-api which sets up multiple endpoints easily. Use NSwagStudio to Generate an API Client I will be coving the contact related bits of the UI, but the application stops short of implementing the save functionality at this point. The application that the Aurelia CLI outputs is very basics so the Aurelia docs for creating a to-do application and creating a contact manager were used to build the basics of the sample application.

#AURELIA HTTP CLIENT EXAMPLE INSTALL#
npm install bootstrap npm install font-awesome npm install aurelia-fetch-client We are going to install a couple of UI related items, Bootstrap and Font Awesome, as well as the Aurelia Fetch Client which we will need to hit our API. Now the project needs a few more dependencies installed. If you do go with Yarn some of the following steps will need the npm commands translated to Yarn commands.Īfter the project creation process is complete use the following command to change to the new directory created for the project. The sample project is using npm, but Yarn is also an option. The base URL and headers can be merged, but currently no other defaults will be applied in this case.Finally, select how you would like to manage dependencies.
