propagande
propagande
Last updated a year ago by dezmou .
ISC · Original npm · Tarball · package.json
$ cnpm install propagande 
SYNC missed versions from official npm registry.

Propagande

Let your front-ends know your message

Propagande is a light library to make server-to-client call, with authentification management

Client-side route

  • Make an express-like route in your browser javascript

Client (Browser):

propagandeApp.addRoute("hello", (params) => {
    console.log(params);
})
  • Then in your nodejs express app, you can call the route of every client connected at once

Server (Node):

await propagandeApp.callRoute('hello', "hello everyone !"),

User Creation and login:

  • Create an user from the server-side

Server (Node):

await propagandeApp.createUser({name: 'roulio',password: 'chien'})
  • you can now login from the client, a cookie session is created and the client doesn't have to reconnect after refreshing the browser.

Client (Browser) :

await propagandeApp.login({name: 'roulio',password: 'chien'})
  • To end a session you can use logout
await propagandeApp.logout()

Call a particular user route from server:

  • Once users are created, the server can call the route of only specified user

Server (Node):

await propagandApp.callRouteUser('roulio', 'hello', "hey, damn you in particular !"),

Front (Browser):

  • The browser code is the same as above
await propagandeApp.login({name: 'roulio',password: 'chien'})
propagandeApp.addRoute("hello", (params) => {
    console.log(params);
})

Groups Management

  • You can also create groups, then assign users to it, then call entire group at once

Server (Node):

await propagandeApp.createGroup('paidUsers')
await propagandeApp.addUsersToGroup(["roulio", "raoul", "cindy"], 'paidUsers')
await propagandeApp.callRouteGroup('paidUsers', 'hello', "hello to all the paid-users")

Setup Propagande

In your NodeJS Express application

$> npm install --save propagande
const { propagandeServer } = require("propagande")
const express = require("express")

//...

// your express app
const app = express();
app.listen(4000)

const propagandeApp = await propagandeServer({
    appName: "fougere", //Give your propagandeApp a name
    // You must create an admin with all right privileges
    admin: { 
        name: "admin",
        password: "admin"
    },
    app, //give your express app
    expressPort: 4000 //give the port of your express app
})

Use Propagande Client in your browser

<script src="propagande-min.js"></script>
const propagandeApp = await propagandeClient({
    appName: "fougere", //name of your propagande app
    url: 'http://localhost:4000' // url and port of your express application
})

Current Tags

  • 1.1.0                                ...           latest (a year ago)

33 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.31                                ...           a year ago
  • 1.0.30                                ...           a year ago
  • 1.0.29                                ...           a year ago
  • 1.0.28                                ...           a year ago
  • 1.0.27                                ...           a year ago
  • 1.0.26                                ...           a year ago
  • 1.0.25                                ...           a year ago
  • 1.0.24                                ...           a year ago
  • 1.0.23                                ...           a year ago
  • 1.0.22                                ...           a year ago
  • 1.0.21                                ...           a year ago
  • 1.0.20                                ...           a year ago
  • 1.0.19                                ...           a year ago
  • 1.0.18                                ...           a year ago
  • 1.0.17                                ...           a year ago
  • 1.0.16                                ...           a year ago
  • 1.0.15                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (13)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |