prologue-examples icon indicating copy to clipboard operation
prologue-examples copied to clipboard

A repository to host examples for Prologue framework written in Nim language.

Prologue framework examples repository

A repository to host examples for Prologue framework.

⚠️ These examples are under development and may change in the future.

Prerequisites

  • Installed Nim compiler (v1.4.0 or above)
  • Installed Prologue framework (v.0.4.0 or above)

You can install Prologue via Nimble: nimble install prologue (or nimble install prologue@#head if you want to get the latest version).

Compile and run examples

Simply call nim compile --run app.nim inside of particular example directory and access 127.0.0.1:8080 URL in your browser. Some examples might have different port number.

HTTP server

  • default settings: http_server
  • custom settings: http_server_custom_settings
  • .env settings: http_server_dotenv
  • basic conf: basic_conf
  • static dir: http_static_server
  • django-like structure: basic
  • websocket: websocket

Requests

  • route basic example: route_basic
  • basic structures: basic_structure
  • anonymous handlers: anon_handler
  • request methods: request
  • URL parameters: url_param
  • URL queries: url_query
  • URL with Regex: regex_url
  • routes with DSL: dsl_routes
  • group routes: group_routes
  • nesting routes: nesting
  • nesting routes with with macro: nesting_with

Responses

  • response basic example: response
  • setting headers: headers
  • templating with Karax DSL: karax_template
  • templating with nimWebTemplates (NWT): nwt_template

Middleware

  • middleware basic example: middleware_basic
  • before and after context switch: middleware_before_after
  • CSRF: csrf
  • CORS: cors
  • session with signed cookie: signed_cookie_session
  • memory session: memory_session
  • redis session: redis_session
  • basic auth: basic_auth

Cookies

  • basic cookies example: basic_cookies

Database

  • Basic CRUD example with native sqlite: basic_crud
  • CRUD with allographer lib: allographer_crud

Sample Apps

  • Hello world: helloworld
  • Blog app: blog
  • ToDo app: todoapp

TODO

  • cors is WIP
  • norm_crud is WIP

Authors

Innokentiy Sokolov, Zeshen Xing, Xie Yanbo