- Node.js
- MySQL v5.6 or higher
-
Node.js
-
Download and install the newest version of Node.js
-
MySQL
-
Download and install MySQL v5.6 or higher (Please remember the user name and password)
-
Create new schema(database). Example: accedo_db
-
Create new table sessions
-
Add 3 columns to sessions: - session_id, Datetype: VARCHAR(45), Primary Key - expires, Datetype: INT(11) - data, Datetype: LONGTEXT
-
Create new table history
-
Add 4 columns to history: - idhistory, Datetype: INT(11), Primary Key - session_id, Datetype: VARCHAR(45), Foreign Key -> sessions- session_id - movie_id, Datetype: VARCHAR(45) - created, Datetype: TIMESTAMP, Default Value: CURRENT_TIMESTAMP
-
Run MySQL
-
In file server.js replace the user, password and database values to yours. Example:
var db_options = {
host: 'localhost',
//port: 3306,
user: 'your_db_username',
password: 'your_db_password',
database: 'your_db'
};
var optionsss = {
host: 'localhost',
//port: 3306,
user: 'your_db_username',
password: 'your_db_password',
database: 'your_db',
schema: {
tableName: 'sessions',
columnNames: {
sessions_id: 'sessions_id',
expires: 'expires',
data: 'data'
}
}
};
-
In Command line go to your application directory and use
node server.js
to run your server (if you are using LINUX usesudo node server.js
) -
Enjoy your application