<commit_before>Mongoose - Embedded Web Server
==============================

This BlackBerry 10 WebWorks extension provides additional APIs supplying an embedded Web Server.

The API gives you the ability to serve files outside the protexted application directory.

The reason for writing this API is that you can't download media from an external server and display it within a WebWorks application. 
This API overcomes this limitation allowing access of the Apps data or tmp directories using a URI like http://localhost:8080/

** Tested On **

BlackBerry Z10 10.1.0.2312

BlackBerry 10 Dev Alpha C 10.2.0.341

** Author(s) **

Extension - [Peardox] (http://supportforums.blackberry.com/t5/user/viewprofilepage/user-id/325249)

Mongoose - [valenok] (https://github.com/valenok)

## Building and Testing the Sample

1. Deploy the extension into your BB10 WebWorks SDK by copying the community folder from the ext folder to the Framework/ext folder in your WebWorks SDK, or run the Ant build script in the /ext folder to do so.
2. Package the sample in the sdtest folder. Use the [Ant Build Script](https://github.com/blackberry/BB10-WebWorks-Community-Samples/tree/master/Ant-Build-Script), or you can do this with the WebWorks packager command:
	__bbwp__ sdtest -g _signingpassword_
3. Load it on your phone using the Ant Build Script, or with the _blackberry-deploy_ command found in the dependencies/tools folder of your WebWorks SDK.

## Including the feature in your application
Whenever you use the below feature id in any of your WebWorks applications this extension will be loaded for use.
```xml
<feature id="community.mongoose" required="true" version="1.0.0.0" />
```

## The Extension API
The Mongoose Extension provides the following API:

```javascript
var result = community.mongoose.start(options); // Start the server using the defined options (see below)

/*
Result is a javascript object with the following properties - status and error are always returned the rest depend on circumstances

status,          // Did the server start - true or false
error,           // false or an error message
command_errors   // Number of passed options that were invalid
listening_ports, // Port the web server is running on
document_root,   // Base path documents are being served from
mongoose_version // Version of Mongoose in this release

*/
```

```javascript

community.mongoose.stop();  // Stop the server<commit_msg>Wrong name in readme for demo<commit_after>Mongoose - Embedded Web Server
==============================

This BlackBerry 10 WebWorks extension provides additional APIs supplying an embedded Web Server.

The API gives you the ability to serve files outside the protexted application directory.

The reason for writing this API is that you can't download media from an external server and display it within a WebWorks application. 
This API overcomes this limitation allowing access of the Apps data or tmp directories using a URI like http://localhost:8080/

** Tested On **

BlackBerry Z10 10.1.0.2312

BlackBerry 10 Dev Alpha C 10.2.0.341

** Author(s) **

Extension - [Peardox] (http://supportforums.blackberry.com/t5/user/viewprofilepage/user-id/325249)

Mongoose - [valenok] (https://github.com/valenok)

## Building and Testing the Sample

1. Deploy the extension into your BB10 WebWorks SDK by copying the community folder from the ext folder to the Framework/ext folder in your WebWorks SDK, or run the Ant build script in the /ext folder to do so.
2. Package the sample in the webtest folder. Use the [Ant Build Script](https://github.com/blackberry/BB10-WebWorks-Community-Samples/tree/master/Ant-Build-Script), or you can do this with the WebWorks packager command:
	__bbwp__ webtest -g _signingpassword_
3. Load it on your phone using the Ant Build Script, or with the _blackberry-deploy_ command found in the dependencies/tools folder of your WebWorks SDK.

## Including the feature in your application
Whenever you use the below feature id in any of your WebWorks applications this extension will be loaded for use.
```xml
<feature id="community.mongoose" required="true" version="1.0.0.0" />
```

## The Extension API
The Mongoose Extension provides the following API:

```javascript
var result = community.mongoose.start(options); // Start the server using the defined options (see below)

/*
Result is a javascript object with the following properties - status and error are always returned the rest depend on circumstances

status,          // Did the server start - true or false
error,           // false or an error message
command_errors   // Number of passed options that were invalid
listening_ports, // Port the web server is running on
document_root,   // Base path documents are being served from
mongoose_version // Version of Mongoose in this release

*/
```

```javascript

community.mongoose.stop();  // Stop the server
{'fraction_non_alphanumeric': 0.08029496108152397, 'fraction_numerical': 0.017615731257681278, 'mean_word_length': 4.2168803418803416, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '306245', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1255, 'n_words': 626}