mhagmajer:server-router

v1.0.4Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

mhagmajer:server-router

Server router with authentication for Meteor

Documentation: https://mhagmajer.github.io/server-router/.

Installing

meteor add mhagmajer:server-router

Example

Server-side

1import { ServerRouter } from 'meteor/mhagmajer:server-router';
2
3WebApp.connectHandlers.use(ServerRouter.middleware({
4  paths: [],
5  routes: {
6    hello() {
7      return `You are ${this.userId}`;
8    },
9  },
10}));

Client-side

1import { ServerRouterClient } from 'meteor/mhagmajer:server-router';
2
3const serverRouterClient = new ServerRouterClient({
4  routes: {
5    hello: 1,
6  },
7});
8
9<Button onClick={() => {
10  ServerRouterClient.redirect.hello();  
11}} />