Friday, June 19, 2015

Notes: exporting database from MySQL and importing to MongoDB

MySQL data came from sample data of test-db -

mysqldump --tab=/tmp --fields-terminated-by=, --fields-enclosed-by='"' --lines-terminated-by=, --fields-enclosed-by='"' --lines-terminated-by=0x0d0a employees

mongoimport --db=employees -c=employees -f emp_no,birth_date,first_name,last_name,gender,hire_date --file=employees.txt --type=csv

Thursday, June 18, 2015

Static hosting with Node.js and Express

I'm trying to learn nodejs and I will use this knowledge to power the backend of a RIA such as ExtJS or Angular.

Anyway, to create a static folder to host web files in node, all you need to do is this:

npm install express
mkdir public
#place web documents in public folder

Write a node app:
var express = require('express');
var app=express();


app.listen(8080, function(){
  console.log("Static hosting activated");


Run the node app:
node app.js

Where is this useful? The public folder could be used to host your frontend application and library.