This project is a simple implementation of a front-end system written in Vue3 using 'script setup' and the composition API; it takes advantage of the benefits TypeScript provides. It communicates with a back-end API uing Axios an a pre-shared key (obtained from openexchangerates.org, instructions below). This project was initially provided as a job interview challenge to demonstrate JavaScript knowledge.
- First you need to register for an API key at https://openexchangerates.org/ (Click "Sign Up" and then use the 'Free Plan' link above the prices for paid plans)
- After signing up you will get an API key to use with this project. From your account on the site go to 'App IDs' and copy your App ID
- Paste your App ID over the CHANGE_ME text in the
src/services/constants.ts
file - Now that you have you App ID configured, you can install packages with
npm i
at the terminal (Assuming you have npm installed on your local computer) and thennpm run dev
to start the application. - The terminal will show you what port on localhost the project is running!
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup>
SFCs, check out the script setup docs to learn more.
In this project the Axios package is used to communicate with an external AI (in this case to openexchangerates.org). This is not the only option for making requests to external APIs, but Axios provides a simple and straightforward interface for making these requests and dealing with responses.
Since TypeScript cannot handle type information for .vue
imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue
imports (for example to get props validation when using manual h(...)
calls), you can enable Volar's Take Over mode by following these steps:
- Run
Extensions: Show Built-in Extensions
from VS Code's command palette, look forTypeScript and JavaScript Language Features
, then right click and selectDisable (Workspace)
. By default, Take Over mode will enable itself if the default TypeScript extension is disabled. - Reload the VS Code window by running
Developer: Reload Window
from the command palette.
You can learn more about Take Over mode here.