Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const service = require('restana')({
```js
// accessing service configuration
service.getConfigOptions()
// accessing restana HTTP server instance
service.getServer()
```

#### Example usage:
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ declare namespace restana {
}

interface Service<P extends Protocol> {
getServer(): Server<P>,
getConfigOptions(): Options<P>
use(middleware: RequestHandler<P>, context?: {}): void
route(
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ module.exports = (options = {}) => {

// the "restana" service interface
const app = {
/**
* HTTP server instance
*/
getServer () {
return server
},
/**
* Application configuration options reference
*/
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "restana",
"version": "3.0.2",
"version": "3.1.0",
"description": "Super fast and minimalist web framework for building REST micro-services.",
"main": "index.js",
"types": "index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('Restana Web Framework - Smoke', () => {

it('service options are exposed through getServiceOptions', (done) => {
expect(typeof service.getConfigOptions().server).to.equal('object')
expect(service.getConfigOptions().server).to.equal(service.getServer())
done()
})

Expand Down