-
Clone the source code
-
Open terminal then check installed nodejs version by running 'node -v'. if you are running nodejs below 5 then you need to update the node js version. Follow this link to update the node version. http://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
-
Then run 'npm -v' to check node package manager if already installed. If not then install npm.
-
Now navigate the unzipped project directory(ex- home/todos/). Then run 'npm install' this will install necessary node modules defined in packages.json file.
-
Run 'npm install mysql' this will install node mysql package.
-
create a database "todos"
-
Then create below table -
CREATE TABLE items (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description TEXT(1000),
PRIMARY KEY (id)
);
- Open app.js file find the below code block then change the database host, user, password and db name you have created earlier.
var con = mysql.createConnection({
host: "localhost",
user: "db_username",
password: "db_password",
database: "db_name"
});
-
Now run 'node app.js' to run the server defined in app.js file. this will run application in 4000 port defined in app.js.
-
Now visit "localhost:4000"