Tour of Heroes
This project was created to help represent 4 fundamental apps, each written with Angular, React, Svelte, and Vue (respectively). The heroes and villains theme is used throughout the app.
by John Papa
Why
I love JavaScript and the Web! One of the most common questions I hear is "which framework is best?". I like to flip this around and ask you "which is best for you?". The best way to know this is to try it for yourself. I'll follow up with some articles on my experiences with these frameworks but in the meantime, please try it for yourself to gain your own experience with each.
Live Demos
Hosted in Azure
- Tour of Heroes with Angular
- Tour of Heroes with React
- Tour of Heroes with Svelte - coming soon!
- Tour of Heroes with Vue
Getting Started
- Go to the folder where your preferred web framework is located, and open it's readme
Web Framework | Folder |
---|---|
Vue | vue-app |
What's in the App
Each of these apps contain:
Each of the apps written in the various frameworks/libraries has been designed to have similar features. While consistency is key, I want these apps to be comparable, yet done in an way authentic to each respective framework.
Each project represents heroes and villains. The user can list them and edit them.
Here is a list of those features:
- Start from the official quick-start and CLI
- Client side routing
- Three main routes Heroes, Villains, About
- Handles an erroneous route, leading to a PageNotFound component
- Active route is highlighted in the nav menu
- Routing should use html5 mode, not hash routes
- API
- JSON server as a backend
- App served on one port which can access API on another port proxy or CORS)
- HTTP - Uses most common client http libraries for each framework
- Styling
- Bulma
- SASS
- Font Awesome
- Same exact css in every app
- Editing - Heroes and Villains will be editable (add, update, delete)
- State/Store - Uses a store for state management
- Web development server handles fallback routing
- Generic components
- Modal
- Button Tool
- Card
- Header bar
- List header
- Nav bar
- Props in and emit events out
- Environment variable for the API location
Why Cypress?
Cypress.io makes it easy to run all three apps simultaneously in end to end tests, so you can watch the results while developing.
Why abstracted CSS?
The goal of the project was to show how each framework can be designed to create the same app. Each uses their own specific techniques in a way that is tuned to each framework. However the one caveat I wanted to achieve was to make sure all of them look the same. While I could have used specific styling for each with scoped and styled components, I chose to create a single global styles file that they all share. This allowed me to provide the same look and feel, run the same cypress tests, and focus more on the HTML and JavaScript/TypeScript.
Optional JSON Server
The app uses an API with Azure Functions by default. But you can setup a JSON server for a backend. This allows you to run the code without needing any database engines or cloud accounts. Enjoy!
Problems or Suggestions
Thank You
Thank you to Sarah Drasner, Brian Holt, Chris Noring, Craig Shoemaker, and Ward Bell for providing input and reviewing the code in some of the repos for the Angular, React, Svelte, and Vue apps:
Resources
- VS Code
- Azure Free Trial
- VS Code Extension for Node on Azure
- VS Code Extension Marketplace
- VS Code - macOS keys
- VS Code - Windows keys