UNPKG

5.86 kBMarkdownView Raw
1Node-Brackets
2-------------
3
4Node-Brackets is a [Node.js](http://nodejs.org) module implemented as [Connect](http://www.senchalabs.org/connect/) middleware which
5integrates [Adobe Brackets](http://brackets.io/) code editor in Node.js based web applications.
6It provides exceptionally convenient way to manage, edit and test project files
7directly on the server via web browser. Brackets doesn't have to be installed on
8client machines, it opens in a web browser and communicates with the server over
9standard HTTP or HTTPS protocol.
10
11This module might be useful for remote development, real-time changes and testing,
12development form a thin client or device such as tablet, or it could be used in
13conjunction with other modules for collaboration.
14
15Installation
16------------
17
18Install from npm:
19
20 $ npm install brackets
21
22Usage Examples
23--------------
24
25Create test app:
26
27 $ mkdir my-app
28 $ cd my-app
29 $ npm install connect
30 . . .
31 $ npm install brackets
32 . . .
33
34Add 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
50Start the app:
51
52 $ node index
53
54Open Google Chrome bowser and type **http://localhost:3000** in the address bar.
55At this point you should see “Hello World”. Navigate to **http://localhost:3000/brackets**.
56Now you should see Brackets UI and the contents of your working directory, including Brackets source.
57
58To 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
67NOTE: the specified directories must exist, otherwise an exception will be thrown.
68
69There is an example project based on [Express](http://expressjs.com/) MVC example,
70located 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
72If you want to be able to see your code changes immediately on the live site, without manually restarting Node,
73you could use [node-supervisor](https://github.com/isaacs/node-supervisor) or similar module.
74
75Security Considerations
76-----------------------
77
78Authentication and authorization are outside the scope of this module.
79They should be done by other modules, configured to intercept the request prior to Node-Brackets.
80
81Since Node-Brackets exposes server files for modification over HTTP/HTTPS, it is absolutely critical to
82properly protect your network or file system. It is strongly recommended **not** to use this module on
83production sites, unless you truly understand the security of your system.
84
85Browser Compatibility
86---------------------
87
88Apparently, Brackets is currently working properly only in Google Chrome.
89It kind of works in Firefox but it has some styling problems and JavaScript errors.
90It doesn’t work at all in Internet Explorer.
91However, these problems should be referred to Brackets core team.
92
93Known 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
119Roadmap
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
127Updating Brackets source code
128-----------------------------
129
130TODO:
131
132License
133-------
134
135(MIT License)
136
137Copyright (c) 2012 Boyan Rabchev <boyan@rabchev.com>. All rights reserved.
138
139Permission is hereby granted, free of charge, to any person obtaining
140a copy of this software and associated documentation files (the
141'Software'), to deal in the Software without restriction, including
142without limitation the rights to use, copy, modify, merge, publish,
143distribute, sublicense, and/or sell copies of the Software, and to
144permit persons to whom the Software is furnished to do so, subject to
145the following conditions:
146
147The above copyright notice and this permission notice shall be
148included in all copies or substantial portions of the Software.
149
150THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
151EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
152MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
153IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
154CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
155TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
156SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\No newline at end of file