I'm currently using Backbone.js for my webapp but I just read about batman.js and I like the features it has to offer. However, I want to know if it integrates with express or am I stuck with the batman server.
I spent a day putting together a boilerplate application, because I wanted to do the same thing, and it didn't seem very clear how to get started. Batman-Express
Batman will work with any server so will be fine with Express. In fact I've read that the seerver side of Batman isn't ready yet so you'd need to use it with something else on the sever for the time being anyway
Related
I'm starting a project to create a front end and back end API that updates in real time.
I was thinking of making something like a Forex "viewer" of sorts using https://www.coinapi.io my only problem is, I want to make the server and everything and have it fetch data from that api, put it in my own DB, and have the frontend update in real time (i.e. a price drops, and it instantly updates without really a refresh).
I'm wondering if something like this is practical. I think its a great idea and I'm super interested in this.
I guess I would use websockets, but I don't know the first thing about that, my experience is with REST API's.
Any ideas/thoughts would be nice.
The frameworks and resources ill be using are:
Bootstrap
Vue.Js
Chart.Js
Node.Js
Express
CoinAPI
MongoDB
Mongoose
I think Express and Socket.io would be a good solution here. They work really well together and you would have crossbrowser checks and a lot of stuff you get with Socket.io out of the box. If you would use your own WebSockets you would have to write all this stuff, which is also a good thing if you know what you are doing.
It can work really well and fast, of course it always depends how well you write your code. But the idea will work fine.
Here you have a beginner friendly tutorial for socket.io:
https://www.youtube.com/watch?v=tHbCkikFfDE
And here is one with MongoDB: https://www.youtube.com/watch?v=8Y6mWhcdSUM
I'm new to Javascript frameworks and looking for framework for my new projects. Until now i created simple apps using MVC framework Django with Bootstrap frontend. Thanks framework i got everything in one package with best-practice well know. For Javascript i used some jQuery libraries without understanding, just configured with doc help.
When i tried to write some Javascript on my own and found there are big changes in JS world (like ES6, TypeScript) i found it very usefull. When i found JS frameworks, i felt in love.
I have read about frameworks, watched some tutorials. As many other, i found React nice. But what i'm completely missing, is the server part. Especially React tutorials creates components or functions, nice UI, but don't cover what happens with data next. I know that React is ment as "V" in MVC. But what is the best-practice or wide-used extension for server part? Are there tutorials or book to take me further than just creating actions and UI?
Thanks for any links, i just need to point best direction. Or is React ment for just specific project parts and better to look elsewhere?
As you said, yes there are quite a number of tutorials and most of them don't cover how do you deploy node apps on the servers. I'll assume you have some server admin knowledge so I'll skip straight to the meat of the setup.
The Server Setup
Regardless of it being a simple static page, a single page API or a react app, you will need to have Node.js installed on any server you will want it to run. Second you will need a production process manager for Node.js. My personal favourite is PM2. The process manages makes sure your app is always on and restarts it if it goes down for whatever reason. You will also need a reverse proxy server (you need this for security and SEO purposes). Again, a go-to for it is Nginx (it's a competitor of Apache)
Two very good tutorials for setting up your server are
Tut #1
Tut #2
The App Setup
Apart from all the server setup you need to handle routing for your app (what happens when you to go to /blog or /login). A stable standard right now is Express.js. You can do without but then you will need to write a lot of the manual routing by hand in Node.js You will set up Express to server back your Index file and any others you may need.
A good tutorial for configuring your Express for a React app is Video Tut.
He does show a bit more but that is on later videos. You can stop once you get the gist of it.
Advanced Stuff
There's also the matter if you want the JavaScript to be rendered on the server or on the client side. For that you will need to make some more configuration for you app. The video tutorial I linked above should show you how to set that up as well if you are interested.
I've been developing a web app using Node.js, Express, MongoDB, Mongoose and Socket.io for some time now. Version one has just been released and is working great. For version two however, I want to completely redesign the UI and use a front-end framework such as AngularJS. I've been looking at the (MEAN stack) and it looks really promising. Before goin into too much details, I will try to explain the purpose and working of the app so hopefully you will understand my question later on.
My app is a streaming service and has 4 simple models: user, room, song, playlist. These are modeled through Schema's in Mongoose and are stored in the MongoDB database. When a user visits the app, it serves all the HTML through Node.js and Express (and Jade as templating engine). If the user then registers, Socket.io lets the server know a user register, that is then saved to the database and the user is joined in the lobby room. In this room, users can chat, listen to music, etc. This is what I've been using Socket.io for, the communication between users themselves and my server (the server sometimes serves html too through Socket.io). Basically all the messages between Socket.io and the server are really small (chat messages, room objects, song objects, etc).
I'm quite happy with this approach, however, on the client side, the code is not really separated. There are currently two JS files serving the logic. One handles the Socket.io events and manipulates the dom. The other one is a common JS file that does a bit of everything. These two files are now about 5000 lines each. This worries me and I want to find a solution for this in v2.
So I've been looking at AngularJS in the MEAN stack and how to incorporate it in my app. My question is, will this solve my client side problems and can would you recommend taking the effort to do so. Also, how well will Socket.io work with AngularJS? Having both of them might be an overkill for what I'm doing. Do you know of any possible other framework that might be easier to integrate with my current environment? I know it's a bit of a subjective question but if you have any tips or do or don'ts, thanks for sharing! I really appreciate your feedback and if you need more information, I'd be happy to share it with you!
Jordy
I think that real example will be sufficient: https://github.com/btford/angular-socket-io-seed
I am a mostly front end JavaScript developer looking to get more into server side development with Node.js. My current level of understanding of Node is decent, ie. I understand what it is, how to install, and basics of getting it running. What I am interested with now is help / advice on what what to do next in order to get larger applications built. What are best practices / frameworks for getting an HTTP server up and running to serve my front end code (HTML, CSS, and JS). I know that there are things like soket.io once you have the app running for communication with the server but it is the first step I am interested in. Also what are best practice for organizing code on the server (separating out front end and back end files on the server). I would also be interested in any advice on getting a database setup and interfacing with it. I think for now I will wait for anything to do with deploying but eventually I will be looking into that.
I know this is a lot and I'm not looking for anyone to answer all this just some help getting pointed in the right direction for the point that I am at right now. I am also not apposed to paying for an material (as long as it is not crazy expensive) so if you have written any books you think that would help someone at my level please point me to it. As always a huge thanks to anyone who thinks they can help me out.
I would recommend you the Express JS framework. It's easy, powerful, and has awesome documentation.
I would definitely use express.js and mongoose to connect to mongodb to save data. I would not start with socketios until you clearly understand how nodejs and its callback mechanisms work. It gets complex and confusing if you do not understand that properly.
Checkout this post.
Looking for a reference nodejs, expressjs & mongodb app to use as template
If you're new to server-side development, I would suggest you start with one of the web frameworks, something such as express.
I would also recommend Underscore.js for writing cleaner more concise JavaScript. If you're planning a frontend of any significant complexity I would throw in Backbone.js to help structure the application. And if you're not sure about server side templating I have had a very positive experience with Jade.
The more I look at node.js the more, I'm really beginning to like it. Everything is an object like ruby, but it isn't as different ( hippie like :P ). Also you don't have to relearn all these syntaxes that are all globals array_map, array_push...
So is there a similar equivalent of Kohana php for node.js?
I'm assuming node.js is ready for prime time if I wanted to set up a server and everything, or is there anything that I shoud be concerned/worried about. I noticed nodejs.com demo is down, which is a bit concerning if I wanted to go live.
I think express.js is the most common framework for node.js as of now.
If you want to get started with node.js which is freakin awesome if you ask me, you should look(comprehend) into:
npm
http://search.npmjs.org/
express
socket.io
redis
node_redis
mongodb
mongoose
everyauth
Like Jorge said express.js is a very popular framework to develop websites. Also if you master these topics I am sure you will really love node.js.
I am developing a framework inspired by Kohana at https://github.com/sadjow/falcon