Skip to content
This repository was archived by the owner on May 8, 2018. It is now read-only.

Commit 604dc95

Browse files
committed
feat(server): add server decorator
feat(server): add server decorator
1 parent 3cc35c7 commit 604dc95

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/server/decorator.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* @flow
3+
*/
4+
import addMiddlewares from './middlewares'
5+
import API from './api'
6+
import SSR from './ssr'
7+
8+
/**
9+
* Mount API, SSR and middlewares to app.
10+
* @param {Object} app - Express server instance
11+
* @return {Object} - Decorated server instance
12+
*/
13+
export default (app: Object): Object => {
14+
// Add global middlewares
15+
addMiddlewares(app)
16+
// Add API
17+
app.use('/api/v1', API)
18+
// Add SSR
19+
app.use(SSR)
20+
return app
21+
}

0 commit comments

Comments
 (0)