Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sub #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

sub #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
51 changes: 51 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const EXPRESS = require('express');
const APP = EXPRESS();

//Routers
const indexRouter = require('./routes/index');

//set up handlebars, templates, partials
const EXPHBS = require('express-handlebars');
APP.engine('handlebars', EXPHBS({defaultLayout: 'main'}));
APP.set('view engine', 'handlebars');

//set up CSS
APP.use( EXPRESS.static(__dirname + "/public") );

//set up body-parser
const BODYPARSER = require('body-parser');
APP.use( BODYPARSER.urlencoded( {extended: true}) );

//set up cookie-parser
const COOKIE_PARSER = require('cookie-parser');
APP.use( COOKIE_PARSER() );

//set up express-session
const SESSION = require('express-session');
APP.use( SESSION({
secret: "1234",
resave: false,
saveUninitialized: true
}));

//set up express-flash-messages > Use this or express-session
// const COOKIE_SESSION = require('cookie-session');
//
// APP.use(COOKIE_SESSION({
// name: 'session',
// keys: ['1234']
// }));

const FLASH = require('express-flash-messages');
APP.use(FLASH());

//helpers


//

APP.use('/', indexRouter);

APP.listen(3000, () => {
console.log("Listening at localhost:3000");
});
12 changes: 12 additions & 0 deletions helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var FlashHelper = {};

FlashHelper.bootstrapAlertClassFor = function(key) {
return {
"error": "danger",
"alert": "danger",
"notice": "info"
}[key] || key;
};


module.exports = FlashHelper;
Loading