BackendStack21 / restana

Restana is a lightweight and fast Node.js framework for building RESTful APIs.
MIT License
467 stars 27 forks source link

Hook restana directly into http.createServer() #108

Closed schamberg97 closed 4 years ago

schamberg97 commented 4 years ago

This PR allows restana to be directly hooked into http native server like this:

'use strict'

const http = require('http')
const service = require('restana')()

service.get('/hi', (req, res) => {
  res.send({
    msg: 'Hello World!'
  })
})

http.createServer(service).listen(3000, '0.0.0.0', function () {
  console.log('running')
})
jkyberneees commented 4 years ago

Hi @schamberg97, this is GREAT. Could you also add the test cases for this feature? Update the docs? Let me know otherwise, I can do it as well with pleasure.

Regards.

schamberg97 commented 4 years ago

hold on, gimme half an hour

schamberg97 commented 4 years ago

Done, hopefully these new commits will pass the checks!

schamberg97 commented 4 years ago

@jkyberneees it appears something has gone terribly wrong with Travis CI integration, as it reports the build is done, while GitHub still has outdated information. Perhaps re-run is needed.