Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/idlewan/nawak
A web micro-framework in Nimrod, heavily inspired by jester, flask and the like.
https://github.com/idlewan/nawak
Last synced: 2 days ago
JSON representation
A web micro-framework in Nimrod, heavily inspired by jester, flask and the like.
- Host: GitHub
- URL: https://github.com/idlewan/nawak
- Owner: idlewan
- License: mit
- Created: 2014-01-07T11:49:47.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-02T19:08:49.000Z (about 10 years ago)
- Last Synced: 2024-08-04T01:15:36.068Z (3 months ago)
- Language: Nimrod
- Size: 643 KB
- Stars: 108
- Watchers: 5
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nawak
A web micro-framework in Nimrod, heavily inspired by jester, flask and the like.
It is only compatible with the `Mongrel2` server for now.## Minimal example
```nimrod
# helloworld.nim
import nawak_mongrel, strutilsget "/":
return response("Hello World!")get "/user/@username/":
return response("Hello $1!" % url_params.username)run()
```## Installation
Install `Mongrel2` v1.8.1 (`download page `_) by following the instructions in the [manual](http://mongrel2.org/manual/book-finalch3.html). The bindings for `ZeroMQ` may only work with `ZeroMQ` version 4.Start `Mongrel2` either with the provided Makefile in the `example/conf/` folder, or manually:
$ cd example/conf
$ mkdir -p run logs tmp
$ m2sh load
$ sudo m2sh start -everyPlease check that you use a recent compiler version of `Nimrod`/`Nim`. *nawak* only works with a fresh Nimrod compiler.
You can now compile and execute the examples from the `example` folder:
$ cd example
$ nimrod c -d:release helloworld.nim
$ ./helloworld
$ firefox http://localhost:6767/The [nawak_app.nim](https://github.com/idlewan/nawak/blob/master/example/nawak_app.nim) example answers the requirements of the [web framework benchmarks](http://www.techempower.com/benchmarks/). You will want to install PostgreSQL and create the [database and tables](https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/config) to test it out.
## Performance test
If you want to make changes and see how it performs, you can use `wrk` to have a preview of the performance.
The command-line options you will want to use are (from the web framework benchmarks):$ wrk -H 'Host: localhost' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' -d 15 -c 256 -t 1 http://localhost:6767/json