UNPKG

3.65 kBMarkdownView Raw
1Danf
2====
3
4Introduction
5------------
6
7###Another javascript/nodejs framework??
8
9Yes!
10
11###Why?
12
13The 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
17Danf 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
28Object-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
32First, 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).
33Then, 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
37No. It is one possible way.
38
39Hello world
40-----------
41
42```javascript
43// app.js
44
45var danf = require('danf');
46
47danf({
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
66Installation
67------------
68
69```sh
70$ npm install -g danf
71```
72
73Documentation
74-------------
75
76You can access a full documentation [here](doc/index.md).
77
78License
79-------
80
81Open Source Initiative OSI - The MIT License
82
83http://www.opensource.org/licenses/mit-license.php
84
85Copyright (c) 2014 Thomas Prelot
86
87Permission is hereby granted, free of charge, to any person obtaining
88a copy of this software and associated documentation files (the
89"Software"), to deal in the Software without restriction, including
90without limitation the rights to use, copy, modify, merge, publish,
91distribute, sublicense, and/or sell copies of the Software, and to
92permit persons to whom the Software is furnished to do so, subject to
93the following conditions:
94
95The above copyright notice and this permission notice shall be
96included in all copies or substantial portions of the Software.
97
98THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
99EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
100MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
101NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
102LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
103OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
104WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\No newline at end of file