Skip to content
Ethosa edited this page Jun 6, 2023 · 2 revisions

Server Side Rendering

Basic Code of main.nim

import happyx

serve("127.0.0.1", 5000):
  get "/":
    "Hello, world!"

Compilation

nim c -r -d:debug main

public Folder Usage

Project structure:

project/
├─ src/
│  ├─ public/
│  │  ├─ hello.png
│  ├─ main.nim
├─ README.md

main.nim

import happyx

serve("127.0.0.1", 5000):
  ...
  staticDir "public"
  staticDir "/myPath" -> "public"
Clone this wiki locally