Skip to content

Commit

Permalink
feat(GCDWebServer): add plugin (#4302)
Browse files Browse the repository at this point in the history
* add GCDWebServer

* fix plugin ref and add the server options interface

* fix the pluginRef's case

* update name

* add docs
  • Loading branch information
xulihang authored Oct 9, 2022
1 parent 98dc7c4 commit f8c6430
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
* [Printer](plugins/printer.md)
* [Browser Tab](plugins/browser-tab.md)
* [Dynamsoft Barcode Scanner](plugins/dynamsoft-barcode-scanner.md)
* [GCDWebServer](plugins/gcdwebserver.md)
* [Installation](installation.md)
* [FAQ](faq.md)

19 changes: 19 additions & 0 deletions docs/plugins/gcdwebserver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# GCDWebServer

```
$ ionic cordova plugin add cordova-plugin-gcdwebserver
$ npm install @awesome-cordova-plugins/gcdwebserver
```

## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/gcdwebserver/)

Plugin Repo: [https://github.com/xulihang/cordova-plugin-gcdwebserver](https://github.com/xulihang/cordova-plugin-gcdwebserver)

The [GCDWebServer](https://github.com/swisspol/GCDWebServer/) Plugin can start an HTTP server to serve static files.

## Supported platforms

iOS



19 changes: 19 additions & 0 deletions docs/plugins/gcdwebserver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# GCDWebServer

```
$ ionic cordova plugin add cordova-plugin-gcdwebserver
$ npm install @awesome-cordova-plugins/gcdwebserver
```

## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/gcdwebserver/)

Plugin Repo: [https://github.com/xulihang/cordova-plugin-gcdwebserver](https://github.com/xulihang/cordova-plugin-gcdwebserver)

The [GCDWebServer](https://github.com/swisspol/GCDWebServer/) Plugin can start an HTTP server to serve static files.

## Supported platforms

iOS



69 changes: 69 additions & 0 deletions src/@awesome-cordova-plugins/plugins/gcdwebserver/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Injectable } from '@angular/core';
import {
Plugin,
Cordova,
CordovaProperty,
CordovaInstance,
InstanceProperty,
AwesomeCordovaNativePlugin,
} from '@awesome-cordova-plugins/core';

export interface ServerOptions {
port?: number;
folder?: string;
}

/**
* @name gcdwebserver
* @description
* This plugin can start an HTTP server using GCDWebServer
*
* @usage
* ```typescript
* import { GCDWebServer } from '@awesome-cordova-plugins/gcdwebserver';
*
*
* constructor(private gcdwebserver: GCDWebServer) { }
*
* ...
*
*
* await this.gcdwebserver.startServer({});
*
*
* ```
*/
@Plugin({
pluginName: 'gcdwebserver',
plugin: 'cordova-plugin-gcdwebserver',
pluginRef: 'cordova.plugins.GCDServer',
repo: 'https://github.com/xulihang/cordova-plugin-gcdwebserver',
install: '',
installVariables: [],
platforms: ['iOS'],
})
@Injectable()
export class GCDWebServer extends AwesomeCordovaNativePlugin {
/**
* start the server
* @param options {ServerOptions}
* @return {Promise<any>} Returns a promise
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
startServer(options: ServerOptions): Promise<any> {
return;
}

/**
* stop the server
* @return {Promise<any>} Returns a promise
*/
@Cordova({ successIndex: 1, errorIndex: 2 })
stopServer(): Promise<any> {
return;
}

}

0 comments on commit f8c6430

Please sign in to comment.