Awesome
çiçek
"The conventional approach, enforced to a greater or lesser extent, is that you shall use a standard subroutine. I say that you should write your own subroutines." -- Chuck Moore
çiçek is a web server built on top of node.js. It is designed to be:
- Small: çiçek is ~800 lines of code and has only four dependencies:
- Self-contained: çiçek provides useful functions and defaults that allow you to write the backend of a web application with minimal configuration and no extra dependencies. Here's all the things that çiçek does out of the box:
- Parse incoming query parameters, JSONs, and multipart/form-data (files).
- Set content headers.
- Serve data & files.
- Reads/writes cookies (and cryptographically signs/verifies them).
- Cache with etags.
- Compression.
- Print useful output to the console.
- Run the server on each of your cores using cluster.
- Restarting the processes if one fails.
- Writing logs with JSON format and automatic log rotation and compression.
- Universal: çiçek tries to express the universal patterns of a web server in the simplest way that will be practical. I hope that çiçek will let you understand what an HTTP(S) server written on node.js is doing, and maybe even encourage you to write your own.
çiçek borrows both terminology and patterns from express.
Current status of the project
The current version of çiçek, v3.4.4, is considered to be unstable and somewhat complete. Suggestions and patches are welcome. Future changes planned are:
- Improve
cicek.file
's API. - Fix bug when exceptions are thrown in cluster mode.
- Improve initialization of config parameters.
- Add log deletion.
- Upgrade insecure requests.
- Default headers.
- Default errors.
- Add missing tests.
- Add an API reference.
- Add a tutorial.
- Add annotated source code.
Installation
npm install cicek
To use çiçek, you need node.js v4.5.0 or newer (if you wish to support node v0.9.12 and above you'll need to change the busboy version to v0.2.14).
Source code
The complete source code is contained in cicek.js
. It is about 830 lines long.
Annotated source code will be forthcoming when the library stabilizes.
License
çiçek is written by Federico Pereiro (fpereiro@gmail.com) and released into the public domain.