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