-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathREADME.md
More file actions
130 lines (94 loc) · 4.21 KB
/
README.md
File metadata and controls
130 lines (94 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130


[](https://github.com/planety/prologue/releases)
[](https://github.com/planety/prologue#donations)
[](https://discord.gg/e2dB4WT)
# Prologue
What's past is prologue.
## Purpose
`Prologue` is a powerful and flexible web framework written in Nim.
It is ideal for building elegant and high performance web services.
**Reduce magic. Reduce surprise.**
## Documentation
<table class="tg">
<tbody>
<tr>
<td class="tg-0pky">Documentation</td>
<td class="tg-c3ow" text-align="center" colspan="2"><a href="https://planety.github.io/prologue" target="_blank" rel="noopener noreferrer">Index Page</a></td>
</tr>
<tr>
<td class="tg-c3ow">Core API</td>
<td class="tg-0pky"><a href="https://planety.github.io/prologue/coreapi/theindex.html" target="_blank" rel="noopener noreferrer">Index Page</a></td>
<td class="tg-0pky"><a href="https://planety.github.io/prologue/coreapi/application.html" target="_blank" rel="noopener noreferrer">Search Page</a></td>
</tr>
<tr>
<td class="tg-c3ow">Full API</td>
<td class="tg-0pky"><a href="https://planety.github.io/prologue/plugin/theindex.html" target="_blank" rel="noopener noreferrer">Index Page</a></td>
<td class="tg-0pky"><a href="https://planety.github.io/prologue/plugin/plugin.html" target="_blank" rel="noopener noreferrer">Search Page</a></td>
</tr>
</tbody>
</table>
Welcome to write your own experience with Prologue at our [wiki](https://github.com/planety/prologue/wiki).
## Features
- Core
- [x] Configure and Settings
- [x] Context
- [x] Param and Query Data
- [x] Form Data
- [x] Static Files
- [x] Middleware
- [x] Powerful Routing System(based on [nest](https://github.com/kedean/nest))
- [x] Cookie
- [x] Startup and Shutdown Events
- [x] URL Building
- [x] Error Handler
- Plugin
- [x] I18n
- [x] Basic Authentication
- [x] Minimal OpenAPI support
- [x] Websocket support
- [x] Mocking test
- [x] CORS Response
- [x] Data Validation
- [x] Session
- [x] Cache
- [x] Signing
- [x] Command line tools
- [x] Cross-Site Request Forgery
- [x] Clickjacking Protection
## Installation
First you should install [Nim](https://nim-lang.org/) language which is an elegant and high performance language. Follow the [instructions](https://nim-lang.org/install.html) and set environment variables correctly.
Then you can use `nimble` command to install `prologue`.
```bash
nimble install prologue
```
### Chronos Backend
Prologue can use [chronos](https://github.com/status-im/nim-chronos) instead of asyncdispatch via the [kairos](https://github.com/jmgomez/kairos) HTTP server:
```nim
requires "prologue[kairos]"
```
Or without nimble, pass `-d:asyncBackend=chronos` to the compiler. No code changes needed — your handlers work with both backends.
## Usages
### Hello World
```nim
import prologue
proc hello*(ctx: Context) {.async.} =
resp "<h1>Hello, Prologue!</h1>"
let app = newApp()
app.get("/", hello)
app.run()
```
Run **app.nim** ( `nim c -r app.nim` ). Now the server is running at `localhost:8080`.
### More examples
- [HelloWorld](https://github.com/planety/prologue/tree/devel/examples/helloworld)
- [ToDoList](https://github.com/planety/prologue/tree/devel/examples/todolist)
- [ToDoApp](https://github.com/planety/prologue/tree/devel/examples/todoapp)
- [Blog](https://github.com/planety/prologue/tree/devel/examples/blog)
- [Additional examples repository](https://github.com/planety/prologue-examples)
### Extensions
If you need more extensions, you can refer to [awesome prologue](https://github.com/planety/awesome-prologue) and [awesome nim](https://github.com/ringabout/awesome-nim#web).
## Donations
Thanks for supporting me!
https://github.com/sponsors/planety
## Stars
[](https://starchart.cc/planety/prologue)