There are many uses for a single-page application. Whether you’re trying to build lighting fast websites, internal landing pages for your team, or customized endpoints for customers, React with Node.js, Express, and webpack is a popular stack to adopt.
But installing React, Node, Express, and Webpack can be time consuming and error prone, especially if you want to host your single-page application in a separate environment from your production code.
Enter, this template: build and host single-page React apps with Node, Express, and Webpack in minutes! No installations, maintenance, or downloads needed.
Clone the React + Node.js template here
- Create a WayScript account and clone the necessary code: Log in, go here, press clone. This duplicates the template to your own WayScript workspace.
- Navigate to your cloned lair, go to .triggers file, click on the pre-setup trigger, press 'Test' to install dependencies, build the client bundle, and start the server
- You should see a package-lock.json file and build folder get created in your file system
- Click on the endpoint URL of the trigger
- You should see the application running ('Hello World' is displayed)! Don't worry, this is protected and requires anyone to access to be in your workspace and logged in, you can make this public later in the settings of your lair.
- When you are ready to set this live, just go to the deploy tab and press 'Deploy'
Setting your Application Public
Read the WayScript docs on endpoint protection
Issue: MODULE NOT FOUND errors when deploying
Solution: Try deleting your package-lock.json and build folder and re-deploy