crixalis
Lightweight web framework
Last updated 7 years ago by n4kz .
LGPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install crixalis 
SYNC missed versions from official npm registry.

Crixalis

Lightweight web framework for node.js

Features

  • Small, documented and easily extendable core
  • Advanced routing system (content type, method, host) with RegExp support and placeholders
  • Compression support (gzip, deflate)
  • Static file serving support (with ETag, Last-Modified, Expires and LRU-cache)

Synopsis

General usage


var Crixalis = require('crixalis');

Crixalis

	/* Load plugins */
	.plugin('shortcuts')
	.plugin('access', { format: '%7T %-4m %s %9B %-15h %U%q' })

	/* Add route with placeholder */
	.get('/hello/:name', function () {
		/* Prepare data for response */
		this.stash.json = {
			message: 'Hello, ' + this.params.name + '!'
		};

		/* Render response */
		this.render();
	})

	/* Add another route for GET and HEAD methods */
	.route('/info', { methods: ['GET', 'HEAD'] }, function () {
		var that = this;

		require('fs').readFile('./readme.md', function (error, result) {
			if (error) {
				/* Handle error */
				that.error(error);
			} else {
				that.body = result;
				that.render();
			}
		});
	})

	/* Catch everything else */
	.route('*', function () {
		this.redirect('/hello/World');
	})

	/* Start server on port 8080 */
	.start('http', 8080);

Plugins

Available core plugins

  • access Access log (with configurable CLF support)
  • compression Compress response using gzip or deflate compression (also works with static plugin)
  • request Thin wrapper around http.request and https.request
  • shortcuts Route declaration helpers, .get(), .post(), etc.
  • static Serve static files

Static server

Crixalis comes with script for serving static files

	# Start web server on port `8080` and serve files from current folder
	crixalis

	# Start web server on port `3000` and serve files from `~/www/`
	crixalis --port 3000 --path ~/www/

Copyright and License

Copyright 2012-2016 Alexander Nazarov. All rights reserved.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

31 Versions

  • 1.0.0                                ...           4 years ago
  • 0.5.5                                ...           4 years ago
  • 0.5.4                                ...           5 years ago
  • 0.5.3                                ...           5 years ago
  • 0.5.2                                ...           6 years ago
  • 0.5.1                                ...           6 years ago
  • 0.5.0                                ...           6 years ago
  • 0.4.8                                ...           7 years ago
  • 0.4.7                                ...           7 years ago
  • 0.4.6                                ...           7 years ago
  • 0.4.5                                ...           7 years ago
  • 0.4.4                                ...           7 years ago
  • 0.4.3                                ...           7 years ago
  • 0.4.2                                ...           7 years ago
  • 0.4.1                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.3                                ...           7 years ago
  • 0.3.2                                ...           7 years ago
  • 0.3.1                                ...           7 years ago
  • 0.3.0                                ...           7 years ago
  • 0.2.4                                ...           8 years ago
  • 0.2.3                                ...           8 years ago
  • 0.2.2                                ...           8 years ago
  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.9                                ...           8 years ago
  • 0.1.8                                ...           8 years ago
  • 0.1.7                                ...           8 years ago
  • 0.1.6                                ...           8 years ago
  • 0.1.5                                ...           8 years ago
  • 0.1.4                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (3)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |