I did not find any tutorials to how to run the webodf i read his apis and source code i am getting how to start it can anybody share the idea.
- WebODF version 0.5.10-8-gf5949f3
-- Found Java: /usr/bin/java (found version "1.7.0.91")
-- external downloads will be stored/expected in: /home/peoplelink/build/downloads
-- Installed Node.js found: /usr/bin/nodejs - 0.10.25
-- good Node.js found: 0.10.25 (0.10.5 required.)
-- npm found: /usr/bin/npm
-- Android was not found: APK will not be built.
JS file dependencies were updated.
-- Configuring done
-- Generating done
-- Build files have been written to:
i got this but i am not getting to webodf.js file in it i am missed out anything.
I am not not sure what you currently have . But This is how you can configure an application using node.js to serve html files and view/edit odf files.
Lets Start with your Node.js Server
First Create an index.js file(name it whatever you want)in our application directory,then initialize node application using node init.
We will have following folder structure : -
- ./ document-editor
- ../app (our html code and libraries)
- ../index.js
- ../package.json
- ../And some other auto-generated files.
Include all the modules necessary.We are going to use Express,Multer and other util libraries.
var express = require("express"); var multer = require('multer'); //for file handling var util = require('util'); var app = express(); // init express app
Configure Routes and Html files to be served on user request to you server.
app.use(express.static('app')); // use this as resource directory //APP ROUTING URL => FUNCTIONS app.get('/', function (req, res) { res.sendFile(__dirname + "/app/index.html"); }); // this means when we get a request on 'myAppContext/' url provide index.html
Start the Server
//START THE SERVER app.listen(3000, function () { console.log("Listening on port 3000"); });
Note* : Make sure you have node.js envoirnment installed on your system before you start.
Now Lets Look at how we include webodf to our application.
First create a directory in your main folder(we name it 'app'), where all the html,styles and scripts..etc will be stored.
- /app (our html code and libraries)
- ../index.html
- ../script
- ..wodotexteditor-0.5.9(folder)
- ..myScript.js
- ../styles
- ../images
- ../And some other files.
Create an index.html file and include webodf and/or Editor JavaScript libraries(Contains Webodf included in build... so need to download separately).
Create a container element and local script necessary to run webodf editor.Make sure to add a odt file to directory for you test or you can use the one which comes with wodo-editor.
You can refer this link for creating a local webodf editor using wodo-text-editor and complete the above to steps(2 & 3).
After we have done the above things,we will go into our root directory and run 'node index' command.... and that's it folks.
Just hit localhost:3000/ and you will see a workable webodf editor.
I hope this helps to get started with node.js and webodf. I will soon create and full application with open/edit and save features using webodf and node.js. Thanks :)
来源:https://stackoverflow.com/questions/34327721/how-to-use-the-webodf-editor-in-localhost-with-node-js