server-fast
v1.0.6
Published
A packaged used to create HTTP/HTTPS servers fast.
Downloads
1
Readme
Explain
- "server" is a package used to create servers fast.
How To Use
It's very easy to use.
First, lets get the package.
import { Server } from '@hyperflame1/server';
- Second, we must create a new instance of it.
let server = new Server();
- And finally, we run the server.
let port = 8080;
let res = server.open('http', port);
Then, go to "http://localhost:8080/" and thats what the page looks like.
It's a bit empty at the moment, you can draw text or an element on a screen.
server.send(res, 'Hello, World!');
And then, that text will show on the screen.
You can also draw HTML elements on there.
server.send(res, '<div id="element"></div>');
- This is also usable with TypeScript, of course.
npm i node
npm i @hyperflame1/server
const { Server } = require('@hyperflame1/server');
let port = 8080;
type num = number | Number;
function open(p: num): void {
server.open('http', p);
}
open(port);
Web Socket
- WebSocket support will be added later.