/lwr-headless-blog-test

LWR headless blog test

Primary LanguageCSS

Hello World Example

The Hello World recipe contains the minimum code needed to get up and running with a single page LWR app.

Project Setup

The recipe's directory structure looks like this:

scripts/
  └── start-server.mjs  // create and start server
src/
  ├── assets/           // static assets
  │   └── logo.png
  └── modules/          // lwc modules
      └── example/
          └── app/
              ├── app.css
              ├── app.html
              └── app.js
lwr.config.json         // lwr configuration
package.json            // npm packaging configuration

Configuration

The LWR server is configured in lwr.config.json, at the root of the project. The Hello World recipe has one LWC module and one route.

// lwr.config.json
{
    "lwc": { "modules": [{ "dir": "$rootDir/src/modules" }] },
    "routes": [
        {
            "id": "example",
            "path": "/",
            "rootComponent": "example/app"
        }
    ]
}

Learn more in Configure a LWR Project.

Recipe Setup

# from the lwr-recipes root
yarn install
yarn build
cd packages/hello-world
yarn start # dev mode and ESM format

Open the site at http://localhost:3000

See documentation for all commands here.