1.1.0 • Published 5 years ago
propagande v1.1.0
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
- get the minimified version of propagande client here : https://github.com/dezmou/Propagande/blob/master/browser/propagande-min.js
<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
})
1.1.0
5 years ago
1.0.31
5 years ago
1.0.30
6 years ago
1.0.29
6 years ago
1.0.28
6 years ago
1.0.27
6 years ago
1.0.26
6 years ago
1.0.25
6 years ago
1.0.24
6 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.19
6 years ago
1.0.18
6 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago