Deploying a JavaScript app JavaScript applications, when built for production, are just a bunch of static files. You can deploy them to any web server, configure that web server to be SPA-aware, and you should be good to go!
Ensure that you configure all paths to redirect to index.html
because your framework handles the routing. You also need to force HTTPS.
Heroku One easy way to deploy your JavaScript app to production with Okta is with Heroku.
To begin, install the Heroku CLI (opens new window) and run heroku login
.
You can deploy your JavaScript application to Heroku in five steps:
Run heroku create
.
Add the Git remote that's created as a remote for your project.
Create a static.json
file with the configuration for secure headers and redirect all HTTP requests to HTTPS. Make sure to change dist/<your-app>
to have the location of your app's built files.
For static.json
to be read, you have to use the Heroku static buildpack (opens new window) . The static buildpack runs npm run build
by default. For Angular, add --prod
to the build script.
Commit your changes, add the Node.js + static buildpack, and deploy your app.
If your branch isn't named master
, run:
You won't be able to sign in to your application until you add your Heroku app's URLs to your Sign-in redirect URIs , Sign-out redirect URIs , and Trusted Origins on Okta.
For more information, see Angular Deployment with a Side of Spring Boot (opens new window) . This blog post includes instructions for deploying to Heroku, Firebase, Netlify, and AWS S3.
Docker You can package your JavaScript application with Docker, too. See Angular + Docker with a Big Hug from Spring Boot (opens new window) for a blog post that details how. Specifically, see the Create a Docker Container for Your Angular App (opens new window) section.
We also have a tutorial that details how to package a React app with Docker (opens new window) .