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