Is there some kind of equivalent of Rails "Gems" for express.js? Specifically I'm fishing around for something that can read in RSS feeds efficiently, including the ability to accept poorly formed XML files, but my real question is: where do I even get started looking? (or is Express.js too young to have an extension library?)
A lot of people compare express to ROR, but should, as the author also does compare it to sinatra instead of ROR.
Sinatra is a DSL for quickly creating
web applications in Ruby with minimal
effort
If you haven't already installed npm(probably have to install express?) you should. I think you can compare npm to gem. When searching for rss via http://search.npmjs.org I found the following package which could be useful:
http://search.npmjs.org/#/easyrss
Where to start looking:
http://search.npmjs.org/ rss
https://github.com/ node rss
http://google.com node.js rss
Express.js has modules that can act as middleware to express/connect. Modules such as everyauth and session (which is already bundled with connect) add additional functionality to Express and Connect. Express is built on top of Connect.
Several great modules already included into Connect
A quick primer on how Express uses middleware.
I'm not sure about Express specifically, but I know about Node.js npm command that lets you install Node packages.
Alfred's answer is very good, I just want to point out that you shouldn't think of "Express Gems" just like you shouldn't think of "Rails Gems", but instead think of "Node.js Gems" and "Ruby Gems".
You can compare Ruby with Node (as they are both languages), Sinatra (and perhaps Rails, but not 100%) with Express.js.
So there are packages for Node.js which you can install with npm. Express.js is such a package ("gem"). For more packages search npm
If you are interested in Express.js middleware, look here on the Express wiki page
Related
For my understanding, node.js is a javascript-engine which is running javascript-code without using a browser(window-global). You can use javascript on a server. But I saw now a lot of tutorials(react, angular, vue etc.). In every tutorial, I have to install something with npm. I can follow there are several dev-tools which I can use on my local machine to minimize my javscript-files or compile sass to css. But in the end, when I put my files on a webserver, I just have normal javascript-files, css-files etc. No node.js code in it, right?
My question is: React, angular, vue.js etc. are written in just normal javascript without node.js right? The reason why I use npm ist just to install every dependencies with one command, right?
A question more: Is there an any recommended order to learn all these frontend-development stuff? There are so much words I have to google it: angular.js, react, vue.js, vanilla.js, typescript, backbone.js, bower, grunt, webpack, yarn etc... I dont know where I start, so I look into few tutorials, but everytime I go through these tutorials, there is a new word(technology) I have to research.
I think you're getting your terminology a little muddled.
Node.js is a JavaScript runtime, built on Google Chrome’s V8 JavaScript engine. However, that is not to say that Node programs are executed in a browser. They aren’t. Rather, the creator of Node (Ryan Dahl) took the V8 engine and enhanced it with various features (such as a file system API and an HTTP library) to create a program we can use to execute JavaScript on our computers.
Node comes bundled with a package manager called npm which you can use to install packages (such as React and Angular) from the npm registry. These packages are indeed written in normal JavaScript (or a language that compiles to JavaScript, such as TypeScript).
The reason why I use npm is just to install every dependencies with one command, right?
Kinda. You can certainly use npm to install dependencies. However, it does a lot more that that. For example you can use npm scripts to carry out various build tasks, or you can create a package yourself and use npm to publish it to the registry.
A question more: Is there an any recommended order to learn all these frontend-development stuff?
As with everything, it depends. What are you trying to build? It's relatively pointless to learn about Node, npm, React and Angular if you are attempting to build a simple static website. If I were you, I'd define a clear goal and set about learning the technologies you'll need to reach that goal. Saying that, if you are doing anything with front-end development, learning about npm will be a good use of your time.
Here's an article by way of further reading that explains things a little more: https://www.sitepoint.com/an-introduction-to-node-js/
I've been working on node,grunt,bower and yeoman from couple of months. I came across MEAN stack applications, in which expressjs is providing the server environment(my understanding). Are both grunt and express similar?
Requesting for some helpful link on express and MEAN stack.
Express is a webserver framework on top of nodejs (like symphony for php).
Grunt is an automation tool (like make or gulp) and not a webserver.
The only thing they have in common is, that they use the JavaScript programming language.
MEAN is a full stack environment for developing web applications. MEAN uses MongoDB as database backend, Express as webserver framework, AngularJs for the client side and all is based on NodeJs. When your application gets more complex and you need some sort of deployment procedure you may use Grunt to automate this.
I've been building apps on the Rails platform for over a year now. That being said, if you can make any comparisons to the Rails equivalent, it might help all parties involved. Just a thought.
Anyway, I'm trying to wrap my head around node, and the front end framework, ember. I was originally intrigued by stumbling across the MEAN stack. After digging into that a bit, I realized I didn't really like angular all that much, and started looking up alternates. Ember seems pretty awesome, and the syntax seems much cleaner without all of the ng- markup to the DOM. I'd like to experiment with mongoDB, and I feel like this approach will teach me a lot.
My question, I guess, is Express. What is the role of Express when using Node? It seems that Ember (even Angular, for that matter) has a pretty expressive router. In my limited understanding of it all, I thought Express was for routes? I found this, which seems to be a MEEN stack of sorts.
The package.json for MEAN is massive, but that MEEN I linked to, is very tiny, with just express, mongoose, and request. Another question, I suppose, is what are the different roles in a MEAN / MEEN stack? Does that make sense? I'm rambling a bit, lol, but I'm hoping to keep researching and playing with this stuff until I have that 'Ah ha!' moment, you know?
mongoose - seems to be a better way of interacting with mongoDB?
express - routes specific to node?
request - seems simple enough. send external requests to other pages on the web. I can't see what the equivalent package would be in MEAN, is this truly needed?
grunt - runs a bunch of stuff so that all the different parts play nicely together?
Any explanations, links, or help are greatly appreciated.
If you're coming from Rails I'd break it down like this:
node.js -> Ruby - your server side language / platform
express -> Rails - your server side framework, although a little more like Sinatra
grunt -> Rake - your preprocessor / build tool
npm -> gem - your server side package manager
Angular.js / Ember.js -> No direct map, your client side framework.
mongoose.js -> ActiveRecord, but for MongoDb. If you want a SQL ORM use Sequelize
Two other tools worth learning are
bower -> your client side package manager, for things like bootstrap
yeoman -> all round js app scaffolding, ties everything together, a great tool to see how to scaffold "best practice" apps.
I want to know if there is some boilerplate code to use a frontend workflow tool like Yeoman with a backend framework like ExpressJS, if I want to maintain the same codebase for both the front and back ends.
Basically I want to know -
How do the boilerplate code produced by yeoman and express fit in together. Is there a way to integrate the two? (How does the gruntfile fit into the express project)
Can I substitute yeoman's default watch with an express server which reloads pages on update?
Yeoman is currently focused on front-end app development, but we're going to explore back-end integration in the future.
No, actually there isn't any right now.
But you can combine express.js with the component package manager. There is some work left, and you cant use yeoman components in component.
To answer your questions
You can look for components in the component repo that you have used in yeoman. Not the same, but might be a solution.
Use the module supervisor for this. You can get it via npm
I haven't found an easy way of integrating my own Express + H5BP + Angular + Grunt skeletons into Yeoman, and eventually just settled for creating a repo here: https://github.com/ericclemmons/genesis-skeleton
From what I've read, there are projects underway to add express generators, but eventually stacks are going to get complex enough to where you'll have to maintain your own starter app, rather than generating it.
There's an experimental branch with yeoman + express.js G+ Yeoman/Express Article
I found yeoman.js to be very cool for rapid prototyping but does require some ramping up to get used to the various tools it's "opinionated" about. I've decided to go over each of the core tools in some vids that are hopefully helpful: yeoman.js related videos
Yoeman fullstack generator now generates both front end and back end. Other interesting frameworks which do the same are Sails JS and StrongLoop
It is worth noting there is an express-generator project:
official docs
npm page
I am going to give it a go - because I'm folling this tutorial - but other than that I cant comment on its value.
As a pet project, I am trying to get familiar with NodeJS and CoffeeScript, and am finding it hard to get the ball rolling.
I've found plenty of examples of single-file super-simple apps like in CoffeeScript's examples folder, however, none of those really show what a full application would look like. I've also scrounged Google to no avail.
Do you have any examples of medium-sized, multi-file CoffeeScript/NodeJS apps I could learn from?
See this gist: https://gist.github.com/652819
Its pretty much an entire NodeJS app using the Express framework, Redis for session storage, Couchdb as the database and written in CoffeeScript. However, you are asking for code organization. That depends from developer to developer. I personally prefer Express. However if you prefer MVC style then see Geddy.
GitHub is your friend:
https://github.com/stephank/orona (Game)
https://github.com/drewlesueur/simple-websocket (WebSockets)
And if you want even more, take a look at the listing for the Coffee-Script Language. I suppose that 95% of the projects there are related to Node.js at the moment.
The Zappa framework is a coffeescript layer on top of Express, Socket.IO and more. It's quite comprehensive and the examples might contain what you're looking for? https://github.com/mauricemach/zappa/
here is a search for github, for everything writtin in coffeescript and description containing the word "node" - returning 300+ entries
https://github.com/search?langOverride=&language=CoffeeScript&q=node&repo=&start_value=1&type=Repositories&x=0&y=0
By default, it would be the same as a medium-sized, multi-file JavaScript/NodeJS app.
Except you would have source files named *.coffee, and you would invoke the CoffeeScript compiler to build your JavaScript NodeJS app.
EDIT July 25 2013
Sails.js has added CoffeeScript support recently. It's a pretty great framework and will make sense to Rails users right off the bat: http://sailsjs.org/
My original answer follows:
Check out https://github.com/pheuter/brunch-socket-soup
Description: Brunch.io skeleton featuring socket.io, includes a coffeescript server file
from the README...
Make sure to have Brunch.io installed.
Prepare the bowl:
brunch new <your-project-name> -s github://pheuter/brunch-socket-soup
Throw in the ingredients:
npm install
Serve and take sips:
coffee server.coffee && brunch watch
I find it helpful to examine existing node modules which were written in coffee-script, of with which I am ALREADY familiar.
Run a quick search of your (globally) installed node modules, eg..
for x in $(echo $NODE_PATH | tr ':' '\n'); { [[ -d $x ]] && ls $x/**/*.coffee; }
On my system, I'd take a peek at the results (usually with the shortest paths, and which yield the modules with which I am most comfortable).. such as
/usr/local/lib/node_modules/ghfm/src/index.coffee
or
/usr/local/lib/node_modules/ipaddr.js/src/ipaddr.coffee