
Show HN: BlueOak Server Maximizes the Value of Swagger API for Node.js Devs - seanpk8
https://github.com/BlueOakJS/blueoak-server
======
seanpk8
Take a look at our newly released express.js-based, "swagger-matic", server
runtime for Node.js.

BlueOak Server is "swagger-matic" because it maximizes the value of your
Swagger API by using it to drive runtime behavior: It loads your Swagger API,
connects the paths it defines to your implementation code, exposes that API to
the network, and validates that every request is well-formed per that API.

We've got a lot of value from using it on our projects, and hope you will too,
or, at least your criticism will help us make it better for us :-)

------
jstoiko
We've built something similar with RAML in Python. It's called Ramses:
[https://github.com/ramses-tech/ramses](https://github.com/ramses-tech/ramses)

I like the "single source of truth" concept. It makes a lot of sense IMO.

Does it generate the handlers for you or do you have to write them by hand and
hook to the Swagger definition?

~~~
seanpk8
You write your own handler and use the combination of the `operationId` field
and an additional `x-handler` field to location your function. You can think
of it like this: `pathHandler = require('${project-
root}/handlers/${x-handler}').${operationId}`

The server provides dependency injection so that when you implement your
handler-level function it can access several re-usable services to do the
"real work". Generally my handlers are limited to getting the parameters off
the request, passing them on to a (chain of) service(s) and getting the
response back out to the client.

I hope the wiki has some good additional info if you're interested:
[https://github.com/blueoakjs/blueoak-
server/wiki](https://github.com/blueoakjs/blueoak-server/wiki)

