weekee
A wiki base git and markdown, power by Node.js, and can be use with connect or express. Maybe you can also use it as a web editor.
Install
npm install -g weekee
Use As A Command Line Application
After install by npm -g, you can use weekee
like this:
weekee -h
Usage: weekee weekee [options]. To host a directory as a wiki in the browser.
Options:
-h, --help output usage information
-V, --version output the version number
-d, --directory <n> target directory
-p --port <n> listen port, defualt is 8080
-g, --git <n> git origin url
-n, --name <n> git user.name
-e, --email <n> git user.email
weekee
default listen at 8080, and host the current directory.You can change it by options.
$ weekee
info - socket.io started
weekee created! And start listen 8080
Defualt weekee
Use In Project
You can both use weekee's default http server and your own http server write by connect/express/http.
weekee's options are:
/** * Init a weekee * @param * - * - * - * - * - * @param * - * - * - * @param */;
Use the default server:
var weekee = ; ;
then you get a wiki in http://localhost:8080
Use with own server
In server side:
var weekee = ;var connect = ;var http = ; var server = http; ;
The server side weekee is ready.
In front end, you need to connect to server side socket.io. Server side are listening these events:
readFile
: get file content.readFolder
: get files in folder.saveFile
: save file to path.createFile
: create file in path.createFolder
: create folder in path.goBack
: go back to the upper folder.removeFile
: remove file. If in git module, when remove the last file in folder, the folder will be remove at the same time.removeFolder
: remove folder.readFolderAndFile
: Read a file and it's directory. The server side will emitreadFileReply
andreadFolderReply
And server side socket.io will emit these events:
readFileReply
readFolderReply
saveFileReply
createFileReply
createFolderReply
removeFileReply
removeFolderReply
An easy way to create your own page, In front html, you must have tow container:
Then include JS file:
If your node server is listen at 7001, but use nginx in front of your node server listen at 80. Then you can try this:
Bofore include weekee.js
, You can use your own socket.io client to connect to your real node server.
After these, front end can communicate with server side now. If you want to use the default bootstrap style. Just include the JS file.
If you want to get a better editor with ace, just inlcude:
Work with exist project
dependences
Git
todo
- add more unit test
- file change log
- a way to bind more event
Licences
(The MIT License)
Copyright (c) 2013 dead-horse
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.