

Build a ‘Hello World!’ Application in 5 Minutes with Fusion.js
source link: https://www.tuicool.com/articles/hit/Eba6Fne
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Fusion.js, Uber’s open source universal web framework, is designed to make web development easier and produce lightweight, high-performing apps. We initially built Fusion.js to revamp our own websites, and have since offered it to the community as an open source project.
In this tutorial, we walkthrough how to get started with Fusion.js and have a ‘Hello World!’ application up and running in 5 minutes. The tutorial walks through three easy steps, from creating the application to displaying ‘Hello World!’ in the browser. ‘The Hello World!’ application is a good starting point for those seeking to get deeper into the Fusion.js framework.
Step 1: Create a boilerplate app
Creating a Fusion.js application is easy. In this tutorial, we will use Yarn , an open source package manager created at Facebook, to set up the Fusion.js scaffold for our application. Yarn replaces the existing workflow with the npm client or another package manager while remaining compatible with the npm registry. It has the same feature set as existing workflows while operating faster, more securely, and more reliably.
Note: If you have already completed this step, please skip to Step 2: Run your app .
In your terminal, run the following yarn command to create a boilerplate app, hello-world-app :
The command will create a new directory, hello-world-app , that contains all the files needed to set up and run Fusion.js. When Yarn finishes successfully, the terminal will display the message “ Success! You have created a Fusion.js project” . Now go to the newly-created source directory of hello-world-app .
Run ls to view the file structure of hello-world-app .
The directory pages contains the React code for rendering the demo page and the “Page not found” page. The file main.js is the application’s entrypoint, and root.js contains routes.
Step 2: Run your app
You are now ready to start the application you created in Step 1. In your terminal, run the following yarn command in the project’s root directory:
This serves up the Fusion.js demo page, as shown below, on http://localhost:3000.
Step 3: Say ‘Hello World!’
In the final step of this tutorial, you will rewrite the default Fusion.js demo page to make it say ‘Hello World!’ To simplify this step, you must replace the demo code in the existing home.js file with new code that can render the ‘Hello World!’ text in your browser. This means the routes will remain the same and no other code changes are required.
- Open home.js and remove the existing code so the file is completely empty.
- Copy and paste the code snippet below to home.js . This snippet imports the React libraries used to render the ‘Hello World!’ text in your browser.
- Add ‘Hello World!’ text between <div> tags.
- Finally, re-run yarn dev to rerun your application. As soon the server starts again, access your file by visiting http://localhost:3000. The message Build completed in x.xxxs will be shown in the terminal when the server has restarted. In your browser, you should now see your app’s home page displaying ‘Hello World!’
Great job! You’ve just learned how to create a simple application with Fusion.js! Eager to learn more about the web framework? Read our tutorial on how to create plugins with Fusion.js .
If building large-scale web applications interests you, consider applying for a role on Uber’s Web Platform team!
Comments
Popular Articles

Uber’s Big Data Platform: 100+ Petabytes with Minute Latency
October 17, 2018

Introducing Ludwig, a Code-Free Deep Learning Toolbox
February 11, 2019

Meet Michelangelo: Uber’s Machine Learning Platform
September 5, 2017

Why Uber Engineering Switched from Postgres to MySQL
July 26, 2016

Forecasting at Uber: An Introduction
September 6, 2018

Scaling Machine Learning at Uber with Michelangelo
November 2, 2018

Recommend
-
12
Clean nuclear: Oxford start-up 10 years ahead of government targets in race to build fusion plant First Light Fusion said national labs were too slow moving, and held back by red tape
-
74
FeaturesVue scheduler component created using DayPilot JavaScript SchedulerThe schedu...
-
10
Intro I am probably the least qualified person to be writing a blog post about C++. So, please approach this post with some caution. But, why am I writing it then? Well, I am curre...
-
3
Tutorial How To Build a "Hello World" Application with Koa Node.js Introduction
-
12
It’s Getting Hot In HereMay 29 by Tony TranChina’s “Artificial Sun” Fusion Reactor Just Set a World RecordThe reactor got more than 10 times hott...
-
9
Bezos Bezos Bezos Bezos BezosJeff Bezos Is Helping Build a Fusion Power Plant in the UKYes, fusion. Billionaires are pouring hundreds of millions of dollars into fusion energy startups.
-
4
Bienvenido al workshop “Construye tu aplicación de React Native en 30 minutos” 🥳 Hola! Soy Sebastian Gomez @sebasgojs en twitter y trabajo en una empresa llamada
-
11
Fusion Development for Hospitality Apps Part 3: Expanding the Application by Working with Form Data Fusion Development for Hospitality Apps Part 3: Expanding the Application by...
-
5
November 9, 2022 ...
-
5
Germany’s Marvel Fusion to build $150M laser facility in US
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK