Tuesday 20 June 2017

What do you think of my library?

I am finishing the first version of https://serverjs.io/ under the npm name "server". This version is basically a thin layer over express with common default options and middleware already set. The objective is that you don't have to repeat adding the same middleware again and again:const server = require('server'); const { get, post } = server.router; const route = get('/', ctx => 'Hello world'); server(route); The next minor version will add socket.io natively so creating a powerful websocket connection becomes trivial in the same way that handling a GET request is trivial now:const server = require('server'); const { get, post, socket } = server.router; const routes = [ get('/', ctx => 'Hello world'), // Listen for messages and send them to everyone socket('message', ctx => ctx.io.emit('message', ctx.data)) ]; // Launch it all server(routes); I have a couple of questions/topics I'd love feedback with:Would you use it? Why yes/no?What would you improve? What isn't clear?If you have any question about it just let me know.

Submitted June 20, 2017 at 09:38PM by franciscopresencia

No comments:

Post a Comment