From 38d04e2437539b81f6953cb45b950c575a23dce3 Mon Sep 17 00:00:00 2001 From: Fran Pagan Date: Fri, 26 Nov 2021 23:54:28 +0000 Subject: [PATCH] fix: update docs api and cocreateJS script --- docs/form.html | 395 ++++++++++++++++++++++++----------------------- docs/index.html | 40 +++-- docs/module.html | 53 ++++--- docs/server.html | 53 ++++--- 4 files changed, 278 insertions(+), 263 deletions(-) diff --git a/docs/form.html b/docs/form.html index e480964..354cf70 100644 --- a/docs/form.html +++ b/docs/form.html @@ -1,214 +1,217 @@ - - - - - CoCreate-api form Documentation | CoCreateJS - - - - - - - - - - - - - - - -
-
-
-
-
-

CoCreate-api form

-
-
-
- -

CoCreate-api is a simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. CoCreate-api includes the - client component and server side for api processing.

-
-
- - -
- -

Install

- -
-
- -

-

npm i @cocreate/api
-

-

Or you can use cdn link:

-
<script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script>
- -
-

Server run

- -
-
npm run start
- -
-

Dependencies components

- -
-

- CoCreate.js, - CoCreate-api.js, -

- - -
-

Development Guide

- -
- -

1. Directory structure

-

-	|- server
-	  |- apis
-	     |- {module_name}  //. module directory
-	        CoCreate-{module_name}.js
-	     |- ...
-	     crud.js
-	     index.js
-	     WSManger.js
-	
-

2. Development stage

-

(1). Add the module direcotry into server/apis

-

(2). Create CoCreate-{module}.js from CoCreate-xxx.js template

-

(3). Register the module in crud.js

-

-	const CoCreateStripe = require('./apis/stripe/Cocreate-stripe')
-	module.exports.WSManager = function(manager) {
-		new CoCreate.stripe(manager) //. register
-	}
-	
-

(4). Rebuild CoCreate-{moudle}.js by endpoint and action

-

-	var utils= require('../utils');
-	class CoCreateStripe {
-		constructor(wsManager) {
-			this.module_id="stripe";
-			....
+			

CoCreate-api is a simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. CoCreate-api includes the + client component and server side for api processing.

+
+
+ + +
+ +

Install

+ +
+
+ +

+

npm i @cocreate/api
+

+

Or you can use cdn link:

+
<script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script>
+ +
+

Server run

+ +
+
npm run start
+ +
+

Dependencies components

+ +
+

+ CoCreate.js, + CoCreate-api.js, +

+ + +
+

Development Guide

+ +
+ +

1. Directory structure

+

+		|- server
+		  |- apis
+		     |- {module_name}  //. module directory
+		        CoCreate-{module_name}.js
+		     |- ...
+		     crud.js
+		     index.js
+		     WSManger.js
+		
+

2. Development stage

+

(1). Add the module direcotry into server/apis

+

(2). Create CoCreate-{module}.js from CoCreate-xxx.js template

+

(3). Register the module in crud.js

+

+		const CoCreateStripe = require('./apis/stripe/Cocreate-stripe')
+		module.exports.WSManager = function(manager) {
+			new CoCreate.stripe(manager) //. register
 		}
-		init() {
-			if (this.wsManager) {
-				//. endpoint = module_name (ex: stripe)
-				this.wsManager.on(this.module_id, (socket, data) => this.sendStripe(socket, data));
+		
+

(4). Rebuild CoCreate-{moudle}.js by endpoint and action

+

+		var utils= require('../utils');
+		class CoCreateStripe {
+			constructor(wsManager) {
+				this.module_id="stripe";
+				....
 			}
+			init() {
+				if (this.wsManager) {
+					//. endpoint = module_name (ex: stripe)
+					this.wsManager.on(this.module_id, (socket, data) => this.sendStripe(socket, data));
+				}
+			}
+			async sendStripe(socket, data) {
+		        let type = data['type'];
+		        switch (type) {
+		            case 'CreateCustomer':  //. action name
+		            	... Get result by processing
+		                utils.send_response(this.wsManager, socket, {"type":type,"response":result}, this.module_id)
+		                break;
+		            ....
+		        }
+			}
+		}//end Class 
+		module.exports = CoCreateStripe;
+		
+ +

3. Notes

+

(1). Response should be object that have type and response

+
+

type: action name

+

response: result

+
{
+			type: action_name,  	//. string
+			response: result  		//. object or array
 		}
-		async sendStripe(socket, data) {
-	        let type = data['type'];
-	        switch (type) {
-	            case 'CreateCustomer':  //. action name
-	            	... Get result by processing
-	                utils.send_response(this.wsManager, socket, {"type":type,"response":result}, this.module_id)
-	                break;
-	            ....
-	        }
-		}
-	}//end Class 
-	module.exports = CoCreateStripe;
-	
- -

3. Notes

-

(1). Response should be object that have type and response

-
-

type: action name

-

response: result

+

+
+

(2). Endpoint and moudle_id is same

+

(3). Send response

+

+		utils.send_response(that.wsManager, socket, {"type":action_name,"response":result}, moudle_id)
+		
+

(4). Request data structure

{
-		type: action_name,  	//. string
-		response: result  		//. object or array
-	}
-	
-
-

(2). Endpoint and moudle_id is same

-

(3). Send response

-

-	utils.send_response(that.wsManager, socket, {"type":action_name,"response":result}, moudle_id)
-	
-

(4). Request data structure

-
{
-		type: action_name,  	//. string
-		data: request_data  	//. object or array
-	}
-	
- -

How Does It Works

-

CoCreate-api server module works based on cocreate.api.

- -

xxxxxx action_{action_name}. pre_{action_name}

- -

Effects and Styles

- -

Events

-

- -
- -
- - -
- -

Demo

- -
+ type: action_name, //. string + data: request_data //. object or array + } + + +

How Does It Works

+

CoCreate-api server module works based on cocreate.api.

+ +

xxxxxx action_{action_name}. pre_{action_name}

+ +

Effects and Styles

+ +

Events

+

+
- -
-
- -
-
-
-
+ +
+ + +
+ +

Demo

+ +
+
+ +
+ +
+
+ + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
-
-
-
+
-
-
- -
- - - - + + + + + + + diff --git a/docs/index.html b/docs/index.html index df35de2..573b3b5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -44,11 +44,8 @@

CoCreate-api

- - -

CoCreate-api is a simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. CoCreate-api includes the - client component and server side for api processing.

+ client component and server side for api processing.

@@ -201,23 +198,31 @@

-

Demo

- -
+

Demo

+ +
-
- + +
+
+ + + +
+
-
-
+ +
+
-
+ +
+ +
+
@@ -225,9 +230,10 @@

Demo

+ + + diff --git a/docs/module.html b/docs/module.html index 5e0d2f2..3c120e0 100644 --- a/docs/module.html +++ b/docs/module.html @@ -167,38 +167,41 @@

Demo

-
- -
-
-
-
+ +
+
+ + + +
+
+ +
+ +
+ +
+
+ +
+ +
+
-
-
-
- +
- - - - + + + + + + + diff --git a/docs/server.html b/docs/server.html index d2d2a2f..60b63e6 100644 --- a/docs/server.html +++ b/docs/server.html @@ -178,38 +178,41 @@

Demo

-
- -
-
-
-
+ +
+
+ + + +
+
+ +
+ +
+ +
+
+ +
+ +
+
-
-
-
- +
- - - - + + + + + + +