const express = require('express'),
app = express(),
path = require('path'),
config = require('./config'),
bodyParser = require('body-parser'),
Sequelize = require('sequelize'),
sequelize = new Sequelize(config.DB_NAME, config.DB_USER, config.DB_PASSWORD,{
dialect: 'mysql',
host: config.DB_URL,
define:{
freezeTableName: true //Уникальное имя для таблицы, для отключения даты и время timestamps: false
}
}),
session = require('express-session'),
MySQLStore = require('express-mysql-session')(session),
options = {
host: 'localhost',
port: 3306,
user: 'goryach',
password: '9696GORYACHEV',
database: 'library'
},
sessionStore = new MySQLStore(options);
const user = sequelize.define('test',{
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
allowNull: false
},
login: {
type: Sequelize.STRING,
allowNull: false,
unique: true
},
password: {
type: Sequelize.STRING,
allowNull: false
}
},{
timestamps: false
});
app.use(
session({
secret: "trePRTfsgDq",
store: sessionStore,
resave: false,
saveUninitialized: false
})
);
this.but = "<li class='li-bottom'><button id='del'>Закрыть</button></li>";