<commit_before># ![ScreenShot](https://raw.githubusercontent.com/UPPERCASEIO/UPPERCASE.IO/master/LOGO.png)
Easy, Clear, and Powerful Full-stack (server-to-client) MVC Middleware for Dynamic Web Site or Mobile Application Development

Based on [UPPERCASE.JS](https://github.com/Hanul/UPPERCASE.JS)

###### TRANSLATION
* [Korean](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/README_KOR.md)

#### Dependencies
* [Node.js](http://nodejs.org)
* [MongoDB](http://www.mongodb.org)
* [ImageMagick](http://www.imagemagick.org)

#### Supported platforms
* Modern web browsers (including Internet explorers 5.5 and above)
* [Apache Cordova](http://cordova.apache.org/)
* [Appcelerator Titanium](http://www.appcelerator.com/titanium/)

#### Sample project
* Sample

## Install
1. Install UPPERCASE.IO on a directory you want.
2. Add the path of UPPERCASE.IO to environment variables.
	* PC
	My computer - Properties - Advanced system settings - Add UPPERCASE_IO_PATH to environment variables.
	* MAC
	```
	vi .profile
	export UPPERCASE_IO_PATH="{{UPPERCASE.IO PATH}}"
	```
	* Linux
	```
	vi .bash_profile
	or
	vi .profile
	export UPPERCASE_IO_PATH="{{UPPERCASE.IO PATH}}"
	```
3. Run MongoDB.
	`mongod --fork --logpath /var/log/mongodb.log --logappend`
4. Execute a project with BOOT script.
    ex) Project.js
    ```javascript
    require(process.env['UPPERCASE_IO_PATH'] + '/BOOT.js');

    BOOT({
        ...
    });
    ```


## Configuration
Each item is formed as `CONFIG.defaultBoxName = 'Sample';`.

###### CONFIG
* `isDevMode` enables development mode. The default is `false`. If enabled, code compression, caching, and so on are skipped. `true` is recommended in development.
* `webServerPort` specifies a server port for web and web socket. If not, the server won't be booted.
* `sercuredWebServerPort` sets a server port for secured web. If not, the secured web server won't start up.
* `socketServerPort` sets a server port for socket.
* `defaultBoxName` defines the name of the default BOX. If not, `'UPPERCASE.IO'` is provided.
* `title` indicates the title of a project. The default value is `'UPPERCASE.IO PROJECT'`.
* `description` implies the description of a project. The default value is `'UPPERCASE.IO PROJECT'`.
* `isMobileFullScreen` decides whether full screen mode is activated on a mobile browser. The default value is `false`.
* `googleSiteVerificationKey` sets google site verification key.

###### NODE_CONFIG
* `securedKeyFilePath` specifies the path of a key file for a secured web server.
* `securedCertFilePath` specifies the path of a cert file for a secured web server.
* `dbName` defines name of a database to use.
* `dbHost` defines host of a MongoDB server to connect. The default values is `'127.0.0.1'`.
* `dbPort` defines port of a MongoDB server to connect. The default value is `27017`.
* `dbUsername` sets username of a MongoDB server to connect.
* `dbPassword` sets password of a MongoDB server to connect.
* `isDBLogMode` sets `true` to turn on database log mode, which outputs data changes as console log. The default value is `false`.
* `maxDataCount` sets the maximum size of data by find command. The default value is `1000`.
* `maxUploadFileMB` sets the maximum file size of a uploadable file. The default value is `10`.

Configurations for distributed servers are below.
* `thisServerName` specifies the current server name, which is used in distributed server configuration.
* `clusteringServers` specifies information of distributed servers.
* `clusteringPort` specifies ports of distributed servers.
* `socketServers` defines information of socket servers.
* `webSocketServers` defines information of Web socket servers.
* `uploadServers` defines information of upload servers.

###### BROWSER_CONFIG
The same as [BROWSER_CONFIG configuration of UPPERCASE.JS](https://github.com/UPPERCASE-Series/UPPERCASE.JS/blob/master/README.md#configuration).


## BOX
BOX는 UPPERCASE.IO에서의 모듈을 칭합니다.
프로젝트 폴더와 BOX폴더 내부의 각 폴더들의 이름으로 BOX들이 생성됩니다.
예를 들어, 아래와 같이 폴더가 구성되어 있다면 `UUI`, `UANI`, `Yogurt`, `Sample` BOX들이 생성됩니다.
![ScreenShot](https://raw.githubusercontent.com/UPPERCASE-Series/UPPERCASE.IO/master/SampleBOXes.png)

`UUI`, `UANI` 등의 UPPERCASE.IO의 공식 BOX 저장소는 다음 경로에 있습니다.
* [UPPERCASE.IO Official BOX Repositories](https://github.com/UIO-BOX)

#### Basic components of BOX
아래 내용들은 필수가 아닙니다. 프로젝트의 성격에 따라 선택적으로 구성할 수 있습니다.
* `BROWSER` 웹 브라우저에서 구동되는 소스들을 저장하는 폴더입니다.
* `COMMON` 웹 브라우저와 node.js에서 동시에 구동되는 소스들을 저장하는 폴더입니다.
* `NODE` node.js 위에서 구동되는 소스들을 저장하는 폴더입니다.
* `R` 리소스 파일들을 저장하는 폴더입니다.

#### Packaging BOX
패키징을 하게되면 각 폴더들의 js 파일들이 하나로 합쳐집니다. 이를테면 BROWSER 폴더의 내용들은 BROWSER.js로 합쳐집니다. 기타 폴더 및 파일들은 그대로 복사됩니다.
1. PACK.js를 다운로드합니다. (오른쪽 클릭 후 다른 이름으로 저장)
	https://raw.githubusercontent.com/UPPERCASE-Series/UPPERCASE.IO/master/PACK.js
2. PACK.js를 아래와 같이 실행합니다.
	`node PACK {{BOX 이름}}`

#### Extending UPPERCASE.JS
BOX에 맞추어 UPPERCASE.JS의 기능을 확장합니다.
확장된 기능은 {{BOX 이름}}.MATCH_VIEW 와 같은 형식으로 사용합니다.

###### Client package
* `STORE(name)` Browser store class [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/STORE.js)
```javascript
store = TestBox.STORE('testStore');
store.save({ name:, value:, isToSession: })
store.get(name)
store.remove(name)
```
* `REQUEST({method:, uri:}, responseListenerOrListeners)` `REQUEST({method:, uri:, paramStr:}, responseListenerOrListeners)` `REQUEST({host:, port:, isSecure:, method:, uri:, data:}, responseListenerOrListeners)` ajax request.
로딩 바를 사용하지 않으려면 `isNotUsingLoadingBar` 파라미터를 true로 설정합니다. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/REQUEST.js)
* `GET(uri, responseListenerOrListeners)` `GET({uri:, paramStr:}, responseListenerOrListeners)` `GET({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax GET request.
로딩 바를 사용하지 않으려면 `isNotUsingLoadingBar` 파라미터를 true로 설정합니다. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/GET.js)
* `POST(uri:, responseListenerOrListeners)` `POST({uri:, paramStr:}, responseListenerOrListeners)` `POST({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax POST request.
로딩 바를 사용하지 않으려면 `isNotUsingLoadingBar` 파라미터를 true로 설정합니다. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/POST.js)
* `PUT(uri:, responseListenerOrListeners)` `PUT({uri:, paramStr:}, responseListenerOrListeners)` `PUT({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax PUT request.
로딩 바를 사용하지 않으려면 `isNotUsingLoadingBar` 파라미터를 true로 설정합니다. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/PUT.js)
* `DELETE(uri:, responseListenerOrListeners)` `DELETE({uri:, paramStr:}, responseListenerOrListeners)` `DELETE({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax DELETE request.
로딩 바를 사용하지 않으려면 `isNotUsingLoadingBar` 파라미터를 true로 설정합니다. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/DELETE.js)

###### Browser package
* `MATCH_VIEW({uri:, target:})` match view. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/VIEW.js)
* `HREF(uri)` get href. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/HREF.js)
* `GO()` `GO(uri)` go another view. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/GO.js)
* `GO_NEW_WIN()` `GO_NEW_WIN(uri)` go another view on new window. [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/GO_NEW_WIN.js)


## API
기본적으로 프로젝트 구성 시 사용되는 API들입니다.

###### Database
`주의사항` DB의 update명령어가 동시에 여러번 호출 될 경우 모든 update는 같은 데이터(수정된)를 반환합니다.
* `DB(name)` MongoDB collection wrapper [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/DB/NODE/DB.js)
```javascript
db = TestBox.DB('test');
db.create(data, function() {...})
db.create(data, {error:, success:})
db.get(id, function() {...})
db.get(id, {success:, notExists:, error:})
db.get({filter:, sort:, isRandom:}, {success:, notExists:, error:})
db.update(data, function() {...})
db.update(data, {success:, notExists:, error:})
db.remove(id, function() {...})
db.remove(id, {success:, notExists:, error:})
db.find({filter:, sort:, start:, count:}, function() {...})<commit_msg>translate to a half<commit_after># ![ScreenShot](https://raw.githubusercontent.com/UPPERCASEIO/UPPERCASE.IO/master/LOGO.png)
Easy, Clear, and Powerful Full-stack (server-to-client) MVC Middleware for Dynamic Web Site or Mobile Application Development

Based on [UPPERCASE.JS](https://github.com/Hanul/UPPERCASE.JS)

###### TRANSLATION
* [Korean](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/README_KOR.md)

#### Dependencies
* [Node.js](http://nodejs.org)
* [MongoDB](http://www.mongodb.org)
* [ImageMagick](http://www.imagemagick.org)

#### Supported platforms
* Modern web browsers (including Internet explorers 5.5 and above)
* [Apache Cordova](http://cordova.apache.org/)
* [Appcelerator Titanium](http://www.appcelerator.com/titanium/)

#### Sample project
* Sample

## Install
1. Install UPPERCASE.IO on a directory you want.
2. Add the path of UPPERCASE.IO to environment variables.
	* PC
	My computer - Properties - Advanced system settings - Add UPPERCASE_IO_PATH to environment variables.
	* MAC
	```
	vi .profile
	export UPPERCASE_IO_PATH="{{UPPERCASE.IO PATH}}"
	```
	* Linux
	```
	vi .bash_profile
	or
	vi .profile
	export UPPERCASE_IO_PATH="{{UPPERCASE.IO PATH}}"
	```
3. Run MongoDB.
	`mongod --fork --logpath /var/log/mongodb.log --logappend`
4. Execute a project with BOOT script.
    ex) Project.js
    ```javascript
    require(process.env['UPPERCASE_IO_PATH'] + '/BOOT.js');

    BOOT({
        ...
    });
    ```


## Configuration
Each item is formed as `CONFIG.defaultBoxName = 'Sample';`.

###### CONFIG
* `isDevMode` enables development mode. The default is `false`. If enabled, code compression, caching, and so on are skipped. `true` is recommended in development.
* `webServerPort` specifies a server port for web and web socket. If not, the server won't be booted.
* `sercuredWebServerPort` sets a server port for secured web. If not, the secured web server won't start up.
* `socketServerPort` sets a server port for socket.
* `defaultBoxName` defines the name of the default BOX. If not, `'UPPERCASE.IO'` is provided.
* `title` indicates the title of a project. The default value is `'UPPERCASE.IO PROJECT'`.
* `description` implies the description of a project. The default value is `'UPPERCASE.IO PROJECT'`.
* `isMobileFullScreen` decides whether full screen mode is activated on a mobile browser. The default value is `false`.
* `googleSiteVerificationKey` sets google site verification key.

###### NODE_CONFIG
* `securedKeyFilePath` specifies the path of a key file for a secured web server.
* `securedCertFilePath` specifies the path of a cert file for a secured web server.
* `dbName` defines name of a database to use.
* `dbHost` defines host of a MongoDB server to connect. The default values is `'127.0.0.1'`.
* `dbPort` defines port of a MongoDB server to connect. The default value is `27017`.
* `dbUsername` sets username of a MongoDB server to connect.
* `dbPassword` sets password of a MongoDB server to connect.
* `isDBLogMode` sets `true` to turn on database log mode, which outputs data changes as console log. The default value is `false`.
* `maxDataCount` sets the maximum size of data by find command. The default value is `1000`.
* `maxUploadFileMB` sets the maximum file size of a uploadable file. The default value is `10`.

Configurations for distributed servers are below.
* `thisServerName` specifies the current server name, which is used in distributed server configuration.
* `clusteringServers` specifies information of distributed servers.
* `clusteringPort` specifies ports of distributed servers.
* `socketServers` defines information of socket servers.
* `webSocketServers` defines information of Web socket servers.
* `uploadServers` defines information of upload servers.

###### BROWSER_CONFIG
The same as [BROWSER_CONFIG configuration of UPPERCASE.JS](https://github.com/UPPERCASE-Series/UPPERCASE.JS/blob/master/README.md#configuration).


## BOX
A BOX is a unit of a module in UPPERCASE.IO.
BOXes are created with a project folder and folders for BOXes.
For example, if folders are organized below, `UUI`, `UANI`, `Yogurt`, `Sample` BOXes are created.
![ScreenShot](https://raw.githubusercontent.com/UPPERCASE-Series/UPPERCASE.IO/master/SampleBOXes.png)

The official BOXes such as `UUI`, `UANI` are managed by UIO-BOX.
* [UPPERCASE.IO Official BOX Repositories](https://github.com/UIO-BOX)

#### Basic components of BOX
These components are optional, so can be chosen for your purpose.
* `BROWSER` is a folder for code run on a web browser.
* `COMMON` is a folder for code shared on both browser and node.js.
* `NODE` is a folder for code run on node.js.
* `R` is a folder for resources.

#### Packaging BOX
Packaging results in one combined JS file in each component folder. For instance, all the code in BROWSER folder becomes BROWSER.js. The other artifacts are copied as they are.
1. Download PACK.js. (Save as with the link below)
	https://raw.githubusercontent.com/UPPERCASE-Series/UPPERCASE.IO/master/PACK.js
2. Run PACK.js as below.
	`node PACK {{BOX name}}`

#### Extending UPPERCASE.JS
Extend functions of UPPERCASE.JS to work with a BOX.
The extended functions are used as a form of {{BOX name}}.MATCH_VIEW.

###### Client package
* `STORE(name)` Browser store class [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/STORE.js)
```javascript
store = TestBox.STORE('testStore');
store.save({ name:, value:, isToSession: })
store.get(name)
store.remove(name)
```
* `REQUEST({method:, uri:}, responseListenerOrListeners)` `REQUEST({method:, uri:, paramStr:}, responseListenerOrListeners)` `REQUEST({host:, port:, isSecure:, method:, uri:, data:}, responseListenerOrListeners)` ajax request.
Not to use a loading bar, set `isNotUsingLoadingBar` to true. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/REQUEST.js)
* `GET(uri, responseListenerOrListeners)` `GET({uri:, paramStr:}, responseListenerOrListeners)` `GET({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax GET request.
Not to use a loading bar, set `isNotUsingLoadingBar` to true. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/GET.js)
* `POST(uri:, responseListenerOrListeners)` `POST({uri:, paramStr:}, responseListenerOrListeners)` `POST({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax POST request.
Not to use a loading bar, set `isNotUsingLoadingBar` to true. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/POST.js)
* `PUT(uri:, responseListenerOrListeners)` `PUT({uri:, paramStr:}, responseListenerOrListeners)` `PUT({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax PUT request.
Not to use a loading bar, set `isNotUsingLoadingBar` to true. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/PUT.js)
* `DELETE(uri:, responseListenerOrListeners)` `DELETE({uri:, paramStr:}, responseListenerOrListeners)` `DELETE({host:, port:, isSecure:, uri:, data:}, responseListenerOrListeners)` ajax DELETE request.
Not to use a loading bar, set `isNotUsingLoadingBar` to true. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/CLIENT/REQUEST/DELETE.js)

###### Browser package
* `MATCH_VIEW({uri:, target:})` match view. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/VIEW.js)
* `HREF(uri)` get href. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/HREF.js)
* `GO()` `GO(uri)` go another view. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/GO.js)
* `GO_NEW_WIN()` `GO_NEW_WIN(uri)` go another view on new window. [Example](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/BOX/BROWSER/VIEW/GO_NEW_WIN.js)


## API
기본적으로 프로젝트 구성 시 사용되는 API들입니다.

###### Database
`주의사항` DB의 update명령어가 동시에 여러번 호출 될 경우 모든 update는 같은 데이터(수정된)를 반환합니다.
* `DB(name)` MongoDB collection wrapper [예제보기](https://github.com/UPPERCASE-Series/UPPERCASE.IO/blob/master/EXAMPLES/DB/NODE/DB.js)
```javascript
db = TestBox.DB('test');
db.create(data, function() {...})
db.create(data, {error:, success:})
db.get(id, function() {...})
db.get(id, {success:, notExists:, error:})
db.get({filter:, sort:, isRandom:}, {success:, notExists:, error:})
db.update(data, function() {...})
db.update(data, {success:, notExists:, error:})
db.remove(id, function() {...})
db.remove(id, {success:, notExists:, error:})
db.find({filter:, sort:, start:, count:}, function() {...})
{'fraction_non_alphanumeric': 0.1411867874890383, 'fraction_numerical': 0.0029231218941829875, 'mean_word_length': 5.094050587816174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 36, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7259320', 'n_tokens_mistral': 6261, 'n_tokens_neox': 6660, 'n_words': 1647}