Posts

Showing posts from May, 2013

Let's send some mails via Node.js

Image
In my Android app I'm having a unique comments section from the users to contact me, they send comments and messages to my mail via this layout... Now lets see i want to send a mail, with this three fields, to myself, via my app... I know! An get request to a server, sending this three fields in a mail to myself! Let's do this... first of all... lets fins a library that sends mails bingo!  Nodemailer it s very appropriate for this task... https://github.com/andris9/Nodemailer https://npmjs.org/package/nodemailer Lets's install it.. I use Cloud9 for developing in Node.js the pros are enough and the ide just IDE just works it coud debug in real time, and it got an console with some practice you can make a server and deploying it in no time, now lets see install node mailer. Node has npm (node package manager) it resolves the dependencies via the Package.json or installing the stuf directly into the app via the npm install <name_of_the_library>, we go

Next app...

Image
I'm having a new app deploying to the Android Play Store. This experiment it's a result of Node.js, Heroku and Android. The app gets his resources from a scrapper in node.js, with a timer for working some times in the week, i will give some explanation of how this works later on. The app saves  every value the app needs into a MongoDB database, and the second server delivers this data to the Android client via Json and Rest techniques that gives some velocity to develop of the server and adds simplicity that can be lost in more complex models. This is all for now I'll post some code in short. Bye    

Deploying my little node.js server to Heroku

Image
Once I got every piece of my app in node.js working.  I though on deploying  and the best way to do so for me for the scalability and easiness only Heroku comes to my mind: So lets prepare the environment: First we open an account on  https://www.heroku.com/ Once we have it we need to install the Heroku client the tools for making a deploy  https://toolbelt.heroku.com/ Now lest start... Lets strep into the folder : >cd myapp Add everyting to git: >git init >git add . >git commit -m "first commit" In case of not having an app  >heroku create In the case of having an app lets add it wit the name >heroku git:remote -a myapp The app needs two things before the upload a:    Procfile : A single file indicating wich file the server must start, with the command  web: node server.js  And a Package.json a json structured file indicating name version and package dependencies it must be  something like this           {