UNPKG

5.1 kBMarkdownView Raw
1Brackets Server
2===============
3
4Brackets Server is a server for providing hosted version of the popular code editor [Brackets](http://brackets.io/). The code editor can be loaded directly in the web browser and it doesn’t require additional installations or browser extensions. Brackets works just like the desktop version, except that all projects and files reside on the server instead of the local file system.
5
6The server may be useful for remote development, real-time changes and testing, development form thin clients or devices such as tablets, or it could be used in conjunction with other web applications for collaboration.
7
8To check the current verion of Brackets source used in the server, please see [CHANGELOG](https://github.com/rabchev/brackets-server/blob/master/CHANGELOG.md).
9
10Installation
11------------
12
13Install from npm:
14
15 $ npm install brackets -g
16
17Usage Examples
18--------------
19
20 $ brackets --port 80 --proj-dir /var/projects --supp-dir /var/brackets
21
22**IMPORTANT:** Make sure ***projects*** directory exists.
23
24All arguments are optional.
25
26| Short Option | Long Option | Default Value | Description
27|--------------|------------------|-------------------|------------------------------------------------------------
28| `-p <prot>` | `--port` | `6800` | TCP port on which Brackets server is listening.
29| `-j <dir>` | `--proj-dir` | `~/Projects` | Root directory for projects. Directories above this root cannot be accessed.
30| `-s <dir>` | `--supp-dir` | `~/.brackets-srv` | Root directory for Brackets supporting files such as user extensions, configurations and state persistence.
31| `-d` | `--user-domains` | `false` | Allows Node domains to be loaded from user extensions.
32
33**NOTE:** Some Brackets extensions require external Node.js process, called node domain. Node domains run on the server, thereby allowing arbitrary code to be executed on the server through custom extensions. Since this imposes very serious security and stability risks, Brackets Server will not load nor execute domains from user extensions, unless `-d` option is specifiednod.
34
35Embedding Brackets Server in Web Applications
36---------------------------------------------
37
38Example with Express:
39
40```javascript
41 var path = require("path"),
42 http = require("http"),
43 express = require("express"),
44 brackets = require("brackets"),
45 app = express(),
46 server = http.createServer(app);
47
48 app.get("/", function (req, res) {
49 res.send("Hello World");
50 });
51
52 var bracketsOpts = {
53 projectsDir: path.join(__dirname, ".."),
54 supportDir: path.join(__dirname, "..", "/support")
55 };
56 brackets(server, bracketsOpts);
57
58 server.listen(3000);
59
60 console.log("Your application is availble at http://localhost:3000");
61 console.log("You can access Brackets on http://localhost:3000/brackets/");
62```
63
64**NOTE:** The default values for `projectsDir` and `supportDir` are different when Brackets Server is initiated from code. They are respectively `./projects` and `./brackets`, relative to the current working directory.
65
66Options:
67
68| Option | Default Value | Description
69|------------------|-------------------|------------------------------------------------------------
70| httpRoot | `/brackets` | Defines the root HTTP endpoint for Brackets Server (http://yourdomain.com/brackets).
71| projectsDir | `./projects` | Root directory for projects. Directories above this root cannot be accessed.
72| supportDir | `./brackets` | Root directory for Brackets supporting files such as user extensions, configurations and state persistence.
73| allowUserDomains | `false` | Allows Node domains to be loaded from user extensions.
74
75
76Contributing
77------------
78
79Please see [`CONTRIBUTING.md`](https://github.com/rabchev/brackets-server/blob/master/CONTRIBUTING.md)
80
81License
82-------
83
84(MIT License)
85
86Copyright (c) 2012 Boyan Rabchev <boyan@rabchev.com>. All rights reserved.
87
88Permission is hereby granted, free of charge, to any person obtaining
89a copy of this software and associated documentation files (the
90'Software'), to deal in the Software without restriction, including
91without limitation the rights to use, copy, modify, merge, publish,
92distribute, sublicense, and/or sell copies of the Software, and to
93permit persons to whom the Software is furnished to do so, subject to
94the following conditions:
95
96The above copyright notice and this permission notice shall be
97included in all copies or substantial portions of the Software.
98
99THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
100EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
101MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
102IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
103CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
104TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
105SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.