4 ms·
Show HN: CoServ, a light-weight web framework in Node.js
- smt88 12y agoWhy?
- benlue 12y agoYes, there are many interesting things in coServ. Below are some of them: . Pages of a website usually repeat themselves in a big way. coServ help developers to break up pages into smaller regions and blocks. By doing so, we have better chances to reuse blocks. . Blocks are like the server side web components. . You can embed Javascript code not just in HTML, but into CSS or even Javascript itself. That gives you lots of power to write very concise codes. If you're interested, you can check this slide: https://speakerdeck.com/benlue/an-amazing-web-framework-for-node-dot-js https://speakerdeck.com/benlue/an-amazing-web-framework-for-...
- smt88 12y agoI asked because the problem with the Node community is that everyone creates a new framework instead of using/improving what already exists. You don't seem to have a good reason for creating a new framework, other than not knowing about the other tools or understanding the reasoning for the decisions they've made. There are tons of absolutely excellent, battle-tested Node frameworks that do all the things you want coServ to do, and they've been around for a long time now. Express[1] is hugely popular, and it even forms the basis of other frameworks (like Sails[2]). And, regarding your slide: Node doesn't need its own Rails because it isn't often used the same way Ruby is. When you do want to create a Rails-like project, you can easily start out with Express, Tower[3], Geddy[4], or Sails. You just add components as you go using npm. Need ORM? Just plug it in. With your own framework, you're not going to have nearly as many users. That means it won't be tested, hardened, and improved as much as the existing, popular frameworks. It also means that people who inherit your code will have to learn yet another framework to figure out how to maintain it. Side note: creating dynamic HTML/CSS/JS with JavaScript isn't a good idea because it isn't portable and encourages mixing of intents. If you use Jade[5], SCSS (which you seem not to like for some reason), or LESS[6], you can reuse the views with pretty much any other server-side language. 1. http://expressjs.com http://expressjs.com 2. http://sailsjs.org http://sailsjs.org 3. http://tower.github.io http://tower.github.io 4. http://geddyjs.org http://geddyjs.org 5. http://jade-lang.com http://jade-lang.com 6. http://lesscss.org http://lesscss.org
- benlue 12y agoThanks for your comments. I agree with you that there have been lots of framework (Express, Koa, Sails, Angular, Hapi, Total, React/Flux, etc) in node, but there are still something missing. Each framework has its own merits, and I don't really like to go over who miss what kind of argument. I just like to share some view points with you: . Everyone loves to reuse code, but we don't really have any framework which could help us to achieve that. In coServ, we design 'block' which is similar to what 'class' means to OOP. If you check demo of the coServ website, the source code of the example showing two RSS feeds is actually much shorter than the example of showing one. That's the power of code reuse. Also, 'block' is like a server side web component (https://www.polymer-project.org https://www.polymer-project.org), and web component, imho, is very promising. . Many projects try to solve problems by introducing new syntax over existing standard. Sometimes that's necessary because syntax is the the exact problem they want to solve (e.g. coffee script). However, if everybody does that we'll have fragmentation issues. Based on that, I'd prefer EJS over Jade as the template engine, and that' why we use a EJS-like template engine in coServ. Actually, that's one of coServ's missions: don't create new syntax for developers to learn unless it's absolutely necessary. . In my slide I use Rails as a metaphor to point out that we may need a more advanced web framework for node. In reality, coServ is nothing like Rails (well, it's Sails emulating Rais, at least that's what they said in their website). coServ is much cleaner and more concise: not just in framework itself, but also web applications created by coServ. . I agree that dynamic HTML/CSS/JS would produce none-portable codes. We use dynamic HTML/CSS/JS in coServ as a convenience so we don't have to invent syntax or even a new system. Portability or reusability is achieved by 'blocks' as mentioned earlier (please try the RSS example in coServ demo). I understand a new framework has to fight it's chance to be tested and used. Sometimes we create things not because we know it's going to be very popular but because we believe things could be done in a better way. If I could, I'd invite you to check the source of the coServ demo. Look for the 'index/blocks' directory. It's really simple and straight forward. I can promise that.