0.0.1 • Published 2 years ago

worksut-networking v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Worksut-Networking

This module is prepared for helping you to perform all the network request used on your own platform, here you will not have to create fetch, it really simple to perform an asyncronous API request each time.

How it works?


It works using the architecture CLIENT-REQUESTS, bringing the posibility to perform a lot of API Request per each client, here you will need to create a client and send directly the request to the server. Actually it only allows HTTP requests.

Example


First you need to create your ENV file to storage all the statics url securely.

BASE_URL=https://yourowndominan.xyz

Define all the resource-paths you need to query on.

enum API {
 GET = '/get-request'
}
// Create your client
const client = new NetworkClient(proccess.env.BASEURL);

You need to use Dependency Injection to pass this object to the piece which needs to perform the request, for example, if you are using FLUX-ARCHITECTURE you will need to pass directly to the actions and set the request on that file, let's go to see an example about GET request.

// * Only with TS
import {client} from 'where/your/client/is';

const getRequest = new NetworkRequest(API.GET);
// Send the request directly to the server
client.send(getRequest, (DTO?: YourOwnType, error?: Error) => {
  // Check that you are not receiving an error
  // make whatever you need with your DTO
});

When you create your request, you can pass diferent parameters to configure your own request using differents HTTP Requests.

Diagram


Request->Client: Request object
Note right of Client: Perform the request \n internally
Request-->Client: Waiting to the \n response ...
Client->>Request: Send object \n (DOM?: T, error?: Error)

Contributing


This project is entirely open source, you can contribute helping us to have a better networking module, you can fork this repo and start a PR with the changes you consider on. We are just creating new methods to perform request using WebSockets and other available protiocols like MQTT, it will be realeased in future versions of the software

License


To check the licese please go directly to the LICENSE File

0.0.1

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago