Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 709 Bytes

README.md

File metadata and controls

54 lines (42 loc) · 709 Bytes

Dovzhenko

How to use

Create server

const server = new Server();

server.createServer();

server.listen(PORT)

Create route

...
const { app } = server;

app.append(<url>, async (req, res) => {...});
...

dynamic route

...
const { app } = server;
app.append('/route/:slug', async (req, res) => {...});
...

Subscribe to the channel

...
channel = new Channel(options);

app.append('route', async (req, res) => {
  ...
  await channel.subscribe(req, res, events?: Array<string>);
  ...
});
...

Publish message to the channel

...
app.append('post/route', async (req, res) => {
  ...
  await channel.publish(message, event)
  ...
});