One year ago I had a problem and I decided to solve it. I was teaching Node.js in a workshop with Hacker Paradise and I got to the point where I normally say:

This code is too complex to explain at this point, so let’s just copy/paste it and continue.

That part was when adding all of the middleware to make Express have bodyparser, sessions, cookies, etc. I thought it’d be really nice to have this set of basic functionality working for everyone by default.

Now with server I’d do this and have a fully working website:

const server = require('server');

const { get, post } = server.router; server(

get(ctx => 'Hello world'),

post(ctx => console.log(ctx.data))

);

Modern javascript

Another thing that I didn’t like about Node.js programming is Callback Hell. With Await/Async this is easily solved. Let’s say a simple scrapper that saves the links of the passed url into a database and replies to it:

const server = require('server');

const { get, post } = server.router;

const { render, json } = server.reply;

const fetch = require('node-fetch'); // Up to you how to implement these (Cheerio + MongoDB?)

const scrapeLinks = require('./fetch-links');

const saveLinks = require('./save-links'); server(

get(ctx => render('index.jade')),

post(async ctx => {

const saved = await Links.find({ url: ctx.data }).exec();

if (saved.length) return json(saved);

const body = await fetch(ctx.data).then(res => res.text());

const links = scrapeLinks(body);

await saveLinks(ctx.data.url, links);

return json(links);

})

);

That’s the main logic for it. Quite intuitive and direct compared to the callback way. Async/await are truly awesome.

Achievements

These are the things I am most proud of, from a personal point of view and for the project itself.

I could make the library that I enjoy and use for my personal projects. It is easy and intuitive. I found many bugs and edge cases from daily use and would love that you report any bug that you might find.

While neither of them officially released, it has great socket.io integration and a powerful plugin system. That is on top of being backwards-compatible with any Express middleware that you can find, a big win IMO.

The Documentation has seen a lot of care and hard work. I will do my best to separate it into a different module in the future to be able to redistribute it and use on other projects. Want some nice docs like those? Hire me.

Things I’d change

Make it sooner! I didn’t expect it to take a full year. I knew it was a longer project, but I expected to release it 3–6 months ago. The two main reasons are life, which got in the way, and me trying to make it future-proof.

Get more people using it sooner. When I teach web programming to friends I still follow express route. However I know that if I am spending my time teaching friends and acquaintances they won’t care or they’d even be happy to give me a hand on this.

Next steps

First to take a small break. If it becomes popular it’s probably going to be short, but I’d like to explore some other areas for a bit.

Then, the main priority is expanding the documentation and tutorials. This is a lot of work but IMO one of the best return of investment for any library. If they cannot find it, it doesn’t exist kind of thing.

Finally, make a plan and look forward for the 1.1. This will include official socket.io and the full plugin system. Also, some pre-made plugins such as an auth one, sass, react, etc.

Looking for Sponsors

I’m also looking for sponsors for the project. It doesn’t get many visits but surprisingly it gets a decent and steadily growing number of installs. So this looks like a small but passionate userbase, feel free to sponsor the project: Sponsor website.

Please let me know what what you create:

~happy hacking ♥