Live data from Hacker News

Show HN: Server.js – A modern Express alternative

serverjs.io

11–20 of 124 posts

Re: Show HN: Server.js – A modern Express alternative

#11
post #9
post #8

> npm install server How could the package name "server" be available all these years :D?

Asking the real questions! I wonder if deleted package names are made available again. It makes sense that they did, but it's also a security issue, if one package is removed an attacker could add a new package with the same name and with a malicious functionality.

In theory, no. Unless you have the magic power like what Laurie Voss have. Remember he saved the world by resurrecting left-pad[1]?

[1] http://blog.npmjs.org/post/141577284765/kik-left-pad-and-npm

Re: Show HN: Server.js – A modern Express alternative

#12
post #4
post #3

> Note: this option can be ignored and server.js will work with both .pug and .hbs (Handlebars) file types. [1] : https://github.com/franciscop/server/blob/master/package.jso... I think around express 3 the guys decided to go with a modular approach and decouple the server from any of those heavy ( render ) libraries, as well as body-parser ( once it was core module in express itself ). My really friendly feedback is…

Basically what I find Koa does for me: http://koajs.com

I went from hapi to express simply for the plethora of middleware (specifically passport).

Re: Show HN: Server.js – A modern Express alternative

#13

It is built on top of express to keep all of the good things, but it adds basic middleware and some more advanced functionality like websockets through socket.io and security through helmet by default. It is designed to work perfectly with Promises and async/await, the new ES7 features that makes asynchronous code awesome. Also, I put a lot of work into making the documentation extensive and clear and I'll keep worki…

I like the design of the API, but I don't understand what you mean by "built on top of express?" I see you have express in a plugin module, but I'm not sure how it's being used.

Re: Show HN: Server.js – A modern Express alternative

#14
post #4

Earlier quoted context omitted.

Basically what I find Koa does for me: http://koajs.com

I went from hapi to express simply for the plethora of middleware (specifically passport).

Really? Hapi has its request lifecycle and built-in auth that makes auth much simpler than injecting authentication/authorization middlewares on every route.

Re: Show HN: Server.js – A modern Express alternative

#15
post #8

> npm install server How could the package name "server" be available all these years :D?

It was not available! But it was abandoned and without any content, so after talking with npm for this specific scenario they decided to give it to me.

I wrote an article called "Getting a great npm name": https://medium.com/server-for-node-js/getting-a-great-npm-na...

Re: Show HN: Server.js – A modern Express alternative

#16
post #13

It is built on top of express to keep all of the good things, but it adds basic middleware and some more advanced functionality like websockets through socket.io and security through helmet by default. It is designed to work perfectly with Promises and async/await, the new ES7 features that makes asynchronous code awesome. Also, I put a lot of work into making the documentation extensive and clear and I'll keep worki…

I like the design of the API, but I don't understand what you mean by "built on top of express?" I see you have express in a plugin module, but I'm not sure how it's being used.

It is being used underneath to connect all of the moving parts.

Re: Show HN: Server.js – A modern Express alternative

#17
I'd argue koajs was the first modern express alternative, although it's arguably more of a connect alternative. I've been happily using it since generators were available under a flag with node 0.11 and it has always been a joy. There's a huge list of middleware [0] on their wiki, and you just pull in whatever you need.

It means that your initial setup takes a bit longer, but it forces you to understand all the moving parts.

The session in production tutorial makes no mention of secret rotation, which I'd consider an important detail for a production environment. The docs don't mention the feature either, but if you look at the underlying express-session library you see that the secret can either be a string or an array of strings.

Although redis is an amazing tool, I disagree with recommending it as the first choice for a session store. Unless you really need it or plan on using it for more stuff, you'd probably be better off keeping sessions in whatever data store you're using for the rest of the application. That lets you avoid having to setup and maintain yet another tool.

No documentation at all for how the socket.io stuff is supposed to be configured. Chat tutorial assumes a single-node environment, which I'd consider unreasonable for anything outside of a hackathon. Wouldn't you at the very least want a process per core?

[0] https://github.com/koajs/koa/wiki

Re: Show HN: Server.js – A modern Express alternative

#18
post #3

> Note: this option can be ignored and server.js will work with both .pug and .hbs (Handlebars) file types. [1] : https://github.com/franciscop/server/blob/master/package.jso... I think around express 3 the guys decided to go with a modular approach and decouple the server from any of those heavy ( render ) libraries, as well as body-parser ( once it was core module in express itself ). My really friendly feedback is…

I totally agree, somewhere in the homepage I explain what this package is for. I decided not to bomb myself and not writing "where you should NOT use it" but I still hint to it. Server is good for small to medium projects where you don't want to be writing the same thing again and again. Think of it as express with a bunch of sane defaults and some extra functionality.

An extra render engine does not affect on anything except on file size (and a tiny bit of install time), which is cheap nowadays. If you are making a single big project server might not be the best option, since you might want to fine-tune many things. If you are making several projects per year with Node.js then it is perfect, since you don't want to waste time doing the same thing again and again.

As others commented, express 5 with async/await = Koa.js

BTW, bodyParser was just added back into the core of express.

Re: Show HN: Server.js – A modern Express alternative

#20

It is built on top of express to keep all of the good things, but it adds basic middleware and some more advanced functionality like websockets through socket.io and security through helmet by default. It is designed to work perfectly with Promises and async/await, the new ES7 features that makes asynchronous code awesome. Also, I put a lot of work into making the documentation extensive and clear and I'll keep worki…

Looks interesting -- will check it out. I've definitely found the batteries-not-included nature of express to be annoying at times.
Post reply on HN