UNPKG

4.2 kBMarkdownView Raw
1![Danf](img/small-logo.jpg)
2===========================
3
4[![NPM Version][npm-image]][npm-url]
5[![NPM Downloads][downloads-image]][downloads-url]
6[![Build Status][travis-image]][travis-url]
7
8Introduction
9------------
10
11###Another javascript/nodejs framework??
12
13Yes!
14
15###Why?
16
17The main goal of this full-stack framework is to help you organize, rationalize and homogenize your javascript code (website, api, ...) on both the server (nodejs) and client (browser) sides.
18
19###Which features of this framework can help me to realize that?
20
21Danf provides many features in order to produce an evolutionary, maintainable, testable and performant code:
22* An object-oriented programming layer.
23* An inversion of control design (dependency injection via configurations files).
24* A simple system allowing to use the same code on both the client and server sides.
25* A homogeneous way to handle all kind of events (http request, DOM events, ...).
26* An elegant solution to callback hell preserving asynchronicity.
27* A helper to develop performant ajax applications supporting deep linking.
28* A modular approach to develop and use (open source) modules.
29
30###What?? An object-oriented programming layer?
31
32Object-oriented programming (OOP) is often a controversial topic in the javascript community. Most of the time, you can observe two reactions:
33* - But everything is already object in javascript!
34* - Why the hell do you want to use OOP in javascript?
35
36First, that is not because all variables are objects that a langage can be considered as providing a way to make a straightforward and robust OOP. As for now, native javascript does not allow to make a reliable industrial OOP code (this will be explained in the concept section of the documentation).
37Then, OOP is certainly not a matter of language, but rather a means of architecturing applications. So why not use OOP for a javascript application?
38
39###So, OOP is the way to develop in javascript?
40
41No. It is one possible way.
42
43Hello world
44-----------
45
46```javascript
47// app.js
48
49var danf = require('danf');
50
51danf({
52 config: {
53 events: {
54 request: {
55 helloWorld: {
56 path: '/',
57 methods: ['get'],
58 view: {
59 text: {
60 value: 'Hello world!'
61 }
62 }
63 }
64 }
65 }
66 }
67});
68```
69
70Installation
71------------
72
73```sh
74$ npm install -g danf
75```
76
77Documentation
78-------------
79
80You can access a full documentation [here](doc/index.md).
81
82License
83-------
84
85Open Source Initiative OSI - The MIT License
86
87http://www.opensource.org/licenses/mit-license.php
88
89Copyright (c) 2014 Thomas Prelot
90
91Permission is hereby granted, free of charge, to any person obtaining
92a copy of this software and associated documentation files (the
93"Software"), to deal in the Software without restriction, including
94without limitation the rights to use, copy, modify, merge, publish,
95distribute, sublicense, and/or sell copies of the Software, and to
96permit persons to whom the Software is furnished to do so, subject to
97the following conditions:
98
99The above copyright notice and this permission notice shall be
100included in all copies or substantial portions of the Software.
101
102THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
103EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
105NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
106LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
107OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
108WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
109
110[npm-image]: https://img.shields.io/npm/v/danf.svg?style=flat
111[npm-url]: https://npmjs.org/package/danf
112[downloads-image]: https://img.shields.io/npm/dm/danf.svg?style=flat
113[downloads-url]: https://npmjs.org/package/danf
114[travis-image]: https://img.shields.io/travis/gnodi/danf.svg?style=flat
115[travis-url]: https://travis-ci.org/gnodi/danf
\No newline at end of file