Skip to content
Helmut Tammen edited this page Jan 12, 2016 · 2 revisions

Edit on the Web with Cloud9

To get an easy entry into contributing to the project you can use the Cloud9 development platform. Cloud9 is a great Web-based development platform for node.js projects. You don't have to download or buy IDEs, node.js and npm itself or have to configure it. You just create an account on the internet and create a workspace in which you can do your complete development. When you create a workspace you can define a github repository. Cloud9 then clones from this repo and sets up your workspace.
Inside this workspace you then have an editor which is very good and a terminal where you can run your command line progams like node, npm or git.
Besides code completion and support not only for Javascript but also for Typescript the editor also enables you to debug your application very easily.

Debugging in Cloud9

To debug your application you simply create a new run configuration (menu option: Run -> Run configurations) and set the following values:

  • command: .
  • Runner: Node.js (default)
  • CWD: (select your base directory) That's it. When you start your node.js application (server) you can set breakpoints in your sourcecode, inspect your variables, ...

Developing the n-odata-server-example application

The n-odata-server-example is an example project for the n-odata-server.
We use this application to test our n-odata-server package. You are of course free to create your own application. But if you want a quick starting point use this application.
Simply create a Cloud9 workspace from the mentioned github repo, create a run configuration inside it and start it. Your application is then provided at a URL that you can find, if you click the "Share" button in the upper right corner of your workspace. Run this URL in a browser and add the /odata suffix to get the service document.
E.g.: `https://n-odata-server-example-htammen.c9users.io/odata'

Developing the n-odata-server npm package

Cause we use typescript as development language the ts files have to be transpiled into js files. This can be done on-the-fly in Cloud9 by simply running grunt
Open a terminal in your n-odata-server workspace and type

grunt

or

grunt ts

The files in the lib folder are now watched and on every change of a ts-file the typescript compiler tsc is invoked.

Working on n-odata-server and n-odata-server-example in Cloud9

You want to make changes to the n-odata-server package and test them in the n-odata-server-example application? That's also quite easy with Cloud9. First you have to create two workspaces, one for the n-odata-server package and one for the n-odata-server-example application.
After you made your changes or enhancements to the n-odata-server package you open a terminal inside the workspace and enter

npm pack

This creates a tgz file which contains the complete package in the root folder of the workspace.
You then click on "Share" in the upper right corner of your IDE/workspace. In the dialog that ist openede you find a Preview link. Click on it and open the link. A new browser window opens with the file structure of your workspace. Look for the tgz file and copy the link (right click --> copy link address).
Now switch to the browser window with the n-odata-server-example workspace. Open the package.json file and replace the following line

"n-odata-server": "^0.3.2", (or whatever version is currently used)

with this one

"n-odata-server": "https://preview.c9users.io/htammen/n-odata-server/n-odata-server-0.3.2.tgz",  
(insert the link you copied before here)

You can now test your changes to the n-odata-server.