1 | Node-Brackets
|
2 | -------------
|
3 |
|
4 | Node-Brackets is a [Node.js](http://nodejs.org) module implemented as [Connect](http://www.senchalabs.org/connect/) middleware which
|
5 | integrates [Adobe Brackets](http://brackets.io/) code editor in Node.js based web applications.
|
6 | It provides exceptionally convenient way to manage, edit and test project files
|
7 | directly on the server via web browser. Brackets doesn't have to be installed on
|
8 | client machines, it opens in a web browser and communicates with the server over
|
9 | standard HTTP or HTTPS protocol.
|
10 |
|
11 | This module might be useful for remote development, real-time changes and testing,
|
12 | development form a thin client or device such as tablet, or it could be used in
|
13 | conjunction with other modules for collaboration.
|
14 |
|
15 | Installation
|
16 | ------------
|
17 |
|
18 | Install from npm:
|
19 |
|
20 | $ npm install brackets
|
21 |
|
22 | Usage Examples
|
23 | --------------
|
24 |
|
25 | Create test app:
|
26 |
|
27 | $ mkdir my-app
|
28 | $ cd my-app
|
29 | $ npm install connect
|
30 | . . .
|
31 | $ npm install brackets
|
32 | . . .
|
33 |
|
34 | Add index.js file to my-app directory and enter the following code:
|
35 |
|
36 | ```js
|
37 | var connect = require('connect'),
|
38 | brackets = require('brackets');
|
39 |
|
40 | connect()
|
41 | .use('/brackets', brackets())
|
42 | .use(function (req, res) {
|
43 | res.end('Hello World');
|
44 | })
|
45 | .listen(3000);
|
46 |
|
47 | console.log("\n listening on port 3000\n");
|
48 | ```
|
49 |
|
50 | Start the app:
|
51 |
|
52 | $ node index
|
53 |
|
54 | Open Google Chrome bowser and type **http://localhost:3000** in the address bar.
|
55 | At this point you should see “Hello World”. Navigate to **http://localhost:3000/brackets**.
|
56 | Now you should see Brackets UI and the contents of your working directory, including Brackets source.
|
57 |
|
58 | To limit the access to specific directory/s you can pass an argument to brackets function.
|
59 |
|
60 | * **brackets("resources");**
|
61 | the directory **"./resources/"** will become the project root.
|
62 |
|
63 | * **brackets(\["controllers", "views", "public"\]);**
|
64 | the directory **"./controllers/"** will become the initial project root and the other folders will be accessible via
|
65 | Recent Projects dropdown (the small arrow above the navigation tree).
|
66 |
|
67 | NOTE: the specified directories must exist, otherwise an exception will be thrown.
|
68 |
|
69 | There is an example project based on [Express](http://expressjs.com/) MVC example,
|
70 | located in [https://github.com/rabchev/node-brackets-module/tree/master/examples/express-mvc](https://github.com/rabchev/node-brackets-module/tree/master/examples/express-mvc).
|
71 |
|
72 | If you want to be able to see your code changes immediately on the live site, without manually restarting Node,
|
73 | you could use [node-supervisor](https://github.com/isaacs/node-supervisor) or similar module.
|
74 |
|
75 | Security Considerations
|
76 | -----------------------
|
77 |
|
78 | Authentication and authorization are outside the scope of this module.
|
79 | They should be done by other modules, configured to intercept the request prior to Node-Brackets.
|
80 |
|
81 | Since Node-Brackets exposes server files for modification over HTTP/HTTPS, it is absolutely critical to
|
82 | properly protect your network or file system. It is strongly recommended **not** to use this module on
|
83 | production sites, unless you truly understand the security of your system.
|
84 |
|
85 | Browser Compatibility
|
86 | ---------------------
|
87 |
|
88 | Apparently, Brackets is currently working properly only in Google Chrome.
|
89 | It kind of works in Firefox but it has some styling problems and JavaScript errors.
|
90 | It doesn’t work at all in Internet Explorer.
|
91 | However, these problems should be referred to Brackets core team.
|
92 |
|
93 | Known Issues
|
94 | ------------
|
95 |
|
96 | * Delete command doesn’t refresh correctly the active documents tabs and an error
|
97 | message is displayed if an open document is deleted.
|
98 |
|
99 | Delete command is currently added as an extension, but I believe it should be Brackets core
|
100 | function in the future and therefore I’m not planning to spend more time on Delete.
|
101 |
|
102 | * Check for updates command doesn’t work.
|
103 |
|
104 | This is due to Cross-Origin Resource Sharing not allowed by http://dev.brackets.io/updates/stable/en-US.json.
|
105 | I believe this issue can be resolved only by Brackets team.
|
106 |
|
107 | * Show Developer Tools - doesn't work.
|
108 |
|
109 | Will be fixed.
|
110 |
|
111 | * Performance data always shows 0.
|
112 |
|
113 | Will be fixed.
|
114 |
|
115 | * Live Preview - doesn't work.
|
116 |
|
117 | Will be fixed.
|
118 |
|
119 | Roadmap
|
120 | -------
|
121 |
|
122 | * Move "Find in Files" on the server-side – performance optimization.
|
123 | * Make global install - for easer project creation.
|
124 | * Integrate NPM in the UI
|
125 | * Integrate Supervisor, possibility Brackets to be served from second port.
|
126 |
|
127 | Updating Brackets source code
|
128 | -----------------------------
|
129 |
|
130 | TODO:
|
131 |
|
132 | License
|
133 | -------
|
134 |
|
135 | (MIT License)
|
136 |
|
137 | Copyright (c) 2012 Boyan Rabchev <boyan@rabchev.com>. All rights reserved.
|
138 |
|
139 | Permission is hereby granted, free of charge, to any person obtaining
|
140 | a copy of this software and associated documentation files (the
|
141 | 'Software'), to deal in the Software without restriction, including
|
142 | without limitation the rights to use, copy, modify, merge, publish,
|
143 | distribute, sublicense, and/or sell copies of the Software, and to
|
144 | permit persons to whom the Software is furnished to do so, subject to
|
145 | the following conditions:
|
146 |
|
147 | The above copyright notice and this permission notice shall be
|
148 | included in all copies or substantial portions of the Software.
|
149 |
|
150 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
151 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
152 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
153 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
154 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
155 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
156 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
\ | No newline at end of file |