Skip to content

Commit

Permalink
Merge pull request #23 from mfwahid/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mfwahid authored Oct 15, 2019
2 parents 6d0337f + dd2f5dd commit 25d2b7b
Show file tree
Hide file tree
Showing 8 changed files with 526 additions and 74 deletions.
Binary file added DB/MSSQL/DbScript.sql
Binary file not shown.
28 changes: 21 additions & 7 deletions library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ const chalk = require('chalk');
const debug = require('debug')('app');
const morgan = require('morgan');
const path = require('path');

const sql = require('mssql');

const app = express();
const port = process.env.PORT || 3000

const config = {
user: 'smuser',
password: 'smuser',
server: 'localhost', // You can use 'localhost\\instance' to connect to named instance
database: 'sslib',

options: {
encrypt: false // Use this if you're on Windows Azure
}
}

sql.connect(config).catch(err=>debug(err));

app.use(morgan('tiny'));
app.use(express.static(path.join(__dirname, '/public/')));
Expand All @@ -20,17 +32,19 @@ app.set('views', path.join(__dirname, 'src', 'views'));
//app.set('views', './src/views');
app.set('view engine', 'ejs');

const bookRouter = require('./src/routes/bookRoutes');
const nav = [
{ link: '/books', title: 'Book' },
{ link: '/authors', title: 'Author' },
{ link: '/genre', title: 'Genre' }
];

const bookRouter = require('./src/routes/bookRoutes')(nav);
app.use('/books', bookRouter);
app.get('/', (req, res) =>
res.render('index',
{
title: 'Safwan-Sana Library',
nav: [
{ link: '/books', title: 'Books' },
{ link: '/authors', title: 'Authors' },
{ link: '/genre', title: 'Genre' }
]
nav
}
));

Expand Down
179 changes: 179 additions & 0 deletions library/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "set DEBUG=app & nodemon index.js",
"start": "set DEBUG=app:* & nodemon index.js",
"lint": "eslint index.js"
},
"author": "",
Expand All @@ -18,6 +18,7 @@
"express": "^4.17.1",
"jquery": "^3.4.1",
"morgan": "^1.9.1",
"mssql": "^5.1.0",
"nodemon": "^1.19.3",
"popper": "^1.0.1",
"pug": "^2.0.4"
Expand Down
Loading

0 comments on commit 25d2b7b

Please sign in to comment.