Skip to content

Commit

Permalink
Merge branch 'master' of github.com:camelaissani/frontexpress
Browse files Browse the repository at this point in the history
  • Loading branch information
Camel Aissani committed Jul 1, 2017
2 parents 75ea04f + acebd1e commit bdde105
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ app.get('/user/:id', (req, res) => {
// req.params.id = [1,2,3]
});
```
You can have the full capabilities of Express-style path with this plugin [frontexpress-path-to-regexp](https://github.com/camelaissani/frontexpress-path-to-regexp)

### Middleware object

The middleware object gives access to more hooks
Expand Down Expand Up @@ -211,6 +213,57 @@ import birds from './birds';
app.use('/birds', birds);
```

## Plugins

### Extend frontexpress via plugins:

- [frontexpress-path-to-regexp](https://github.com/camelaissani/frontexpress-path-to-regexp): Add the ability to support Express-style path string such as /user/:name, /user*...

Others are coming

### Write your own plugin

It consists to simply create an object with two properties:
- **name**: the name of your plugin
- **plugin**: the function containing the implementation

Let's assume that we have implemented this plugin in the `frontexpress-my-plugin.js` file as below:

```js
export default {
name: 'My plugin',
plugin(app) {
// the plugin implementation goes here

// Some ideas
// you can get settings
// const transformer = app.get('http GET transformer');
//
// you can set settings
// app.set('http requester', {
// fetch() {
// ...
// }});
//
// you can complete routes
// app.get(...)
}
};
```

To use it:

```js
import frontexpress from 'frontexpress';
import myPlugin from 'frontexpress-my-plugin';

// Front-end application
const app = frontexpress();

// tell to frontexpress to use your plugin
app.use(myPlugin);
```

## More

[API](https://github.com/camelaissani/frontexpress/blob/master/docs/api.md)
Expand Down

0 comments on commit bdde105

Please sign in to comment.