jsisez
v1.0.10
Published
PowerTools for Node.js-Developer
Downloads
2
Readme
JSisEZ
Install
Use this command to install JSisEZ
npm i jsisez
Do not use old versions of jsisez, because I've done many bug-fixes and parts of older versions aren't working correctly!!!
Write const EZ = require('jsisez');
before your code, so you can use this module.
Use
Actually it is only a beta, and I'm testing to work with npm. There are two functions.
init HTTP Server
For me it isn't difficult, to setup a HTTP Server. But it need much of code, where can happen many mistakes, so i decided to make it easier.
To setup a HTTP Server with express write the following code. You don't have to install express or socket.io, its already instaled with JSisEZ.
const {APP} = EZ.initServer();//You can write a custom port between the breaks. Usally the server start on port 80.
APP.get('/', (req, res) =>{
res.end("Hello World");
});
If you want to use a WebSocket, write
const {APP, IO} = EZ.initServer(80, true);//You can use another ports too.
APP.get('/', (req, res) =>{
//code like in express
});
IO.on('connection', (socket) =>{
//code like in socket.io
});
Syntax of initServer()
Require
method: require('jsisez').initServer(port, socket, name)
port optional: int The port, on the server has to start
socket optional: bool Do you need a Web-Socket-Server?
name optional: string Only usefull for debugging. How the server should name? This name will be displayed in the console.
Return
You will get an object with APP, IO and SERVER
APP: The Express-App you get by calling require('express')()
IO only if socket is true: IO is the finish socket.io-Server.
SERVER: The HTTP-Server the APP and IO is running on.
XOR
I haven't found any XOR operator yet. So I created a method to do it.
if (EZ.XOR(true, true)) {
console.log("Yes");
}
Changelog
1.0.0
Creating the module
1.0.1 - 1.0.4
Creating and edditing the Readme-Page
1.0.7
Patching some bugs in the code.
1.0.8 - 1.0.10
Adding some details into the readme.md