Skip to content

juryrigcoder/SSR-dotnet-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enhance SSR C# Example

This project demonstrates using Enhance to serverside render components in C# dotnet.

Download Enhance SSR wasm

Download the latest release of the compiled wasm:

curl -L https://github.com/enhance-dev/enhance-ssr-wasm/releases/download/v0.0.4/enhance-ssr.wasm.gz | gunzip > wasm/enhance-ssr.wasm

Run

  1. Run Server
dotnet watch
  1. load http://localhost:3030/hello/world

Components and Elements

This example demonstrates a way to read elements from a folder and pass them to the Enhance SSR function as JSON. The elements can be formated in several ways:

  1. Plain HTML can be used with .html extension.
  2. Pure functions (with a .mjs or .js extenstion) should return HTML and have a function signature as follows:
// elements/my-header.mjs
function MyHeader({ html, state }) {
  return html`<style>h1 { color: red; }</style><h1><slot></slot></h1><p>Message: ${state?.store?.message || "no message"}</p>`
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published