info
Based on your configuration Stormkit determines whether your application is served as single page or hybrid application.

Angular single page applications

  1. Go to your application.
  2. Click on your environment and then click on Edit.
  3. Turn off the serverless toggle to enable static websites.
  4. Create a stormkit.config.yml file at the root level of your repository and write the following configuration:
    app:
    - redirects:
        - from: /*
          to: /index.html
          assets: false
    

Angular hybrid applications

With Angular projects, you'll need to modify the app slightly and prepare it for Serverless environments. Since in the serverless environments we don't have a concept of long-lived process, we'll need to tell Angular not to listen to any port but rather directly export the app.

server.ts

// server.ts

// You may still want to keep this around for local development
// The SK_APP_ID is injected on build time by Stormkit. This way you
// can distinguish between Stormkit and local environments.
if (!process.env.SK_APP_ID) {
  app.listen(PORT, () => {
    console.log(`Node server listening on http://localhost:${PORT}`);
  });
}

export default app; // app is the return value of the express() call.

webpack.server.config.js

module.exports = {
  output: {
    // Tell webpack to serve static assets from the PUBLIC_URL 
    // which is injected during build time dynamically.
    publicPath: process.env.PUBLIC_URL || "/",
    // By specifying the libraryTarget we tell webpack to 
    // export the app from the bundled file.
    libraryTarget: "commonjs"
  }  
}

Instead of using the PUBLIC_URL you can also tell Stormkit to load specific files from the CDN. Here is an example but more information can be found under redirects & path rewrites section.

app:
- redirects:
    - ext: js,css,ico,png,jpg
      cdn: true