Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mhagmajer/server-router
Server router with authentication for Meteor
https://github.com/mhagmajer/server-router
meteor
Last synced: 4 days ago
JSON representation
Server router with authentication for Meteor
- Host: GitHub
- URL: https://github.com/mhagmajer/server-router
- Owner: mhagmajer
- License: mit
- Created: 2017-05-17T22:00:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-20T11:40:49.000Z (over 3 years ago)
- Last Synced: 2023-03-08T10:27:28.336Z (over 1 year ago)
- Topics: meteor
- Language: JavaScript
- Homepage: https://blog.hagmajer.com/server-side-routing-with-authentication-in-meteor-6625ed832a94
- Size: 1.15 MB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mhagmajer:server-router
Server router with authentication for MeteorIntroductory blog post:
[https://blog.hagmajer.com/server-side-routing-with-authentication-in-meteor-6625ed832a94](https://blog.hagmajer.com/server-side-routing-with-authentication-in-meteor-6625ed832a94).Documentation: [https://mhagmajer.github.io/server-router/](https://mhagmajer.github.io/server-router/).
# Compatibility
Please beware that:
* versions 1.2.x and above require Meteor 1.6.1+
* versions 1.1.x and below require Meteor 1.4.4.2-1.6# Installing
`meteor add mhagmajer:server-router`
You can find Flow type definitions in `/definitions`.
# Example
## Server-side
```js
import { ServerRouter } from 'meteor/mhagmajer:server-router';WebApp.connectHandlers.use(ServerRouter.middleware({
paths: [],
routes: {
hello(name) {
this.res.end(`You ${name}, your id is ${this.userId}`);
},
},
}));
```## Client-side
```js
import { ServerRouterClient } from 'meteor/mhagmajer:server-router';const serverRouterClient = new ServerRouterClient({
routes: {
hello: 1,
},
});{
serverRouterClient.redirect.hello('John');
}} />
```# Publishing (contributors)
Run `npm run clean` before `meteor publish`.