express-redux-sample icon indicating copy to clipboard operation
express-redux-sample copied to clipboard

Coding style

Open MartinPavlik opened this issue 9 years ago • 2 comments

Hi, I would like to suggest some improvements of your coding style. Have you considered using some unified coding style such as ES6 or something like that?

Things like the code below are almost impossible to read :-1:

var listOfActions = [   createDropFunction("users"),                            createTable("users", createUserTableQuery),
                                            createDropFunction("universal_todos"),      createTable("universal_todos", createUniversalTodoListTableQuery),
                                            createDropFunction("personal_todos"),       createTable("personal_todos", createPersonalTodoListTableQuery),
                                            endClientConnection];
module.exports = {

    mysqlParams         : {
                                          socketPath                    : '/var/run/mysqld/mysqld.sock',
                                          user                          : "user",
                                          password                      : "pw",
                                          database                      : "name",
                                          multipleStatements    : true // allows for multiple queries. consider making this a different connection?
                                        },

    sessionOptions  : {
                                  secret: 'somesecretkeythatweshouldgenerateandstoresomewhere', //TODO make real secret
                                  saveUninitialized: true, // save new sessions
                                          resave: false, // do not automatically write to the session store
                                          cookie : { 
                                                                httpOnly: true, 
                                                                maxAge: 2419200000 
                                                            } // TODO set secure to true when https is used
                                        } 

};

Also consider using 2 spaces for indentation instead of tabs, some other things can be found here.

Otherwise I like this repo and its idea! I can create a pull-request and fix this if you want... :+1:

Thanks

MartinPavlik avatar Sep 13 '15 09:09 MartinPavlik

That'd be great! Thanks for the input!

On Sun, Sep 13, 2015 at 2:41 AM, Martin Pavlík [email protected] wrote:

Hi, I would like to suggest some improvements of your coding style. Have you considered using some unified coding style such as ES6 https://github.com/elierotenberg/coding-styles/blob/master/es6.md or something like that?

Things like the code below is almost impossible to read [image: :-1:]

var listOfActions = [ createDropFunction("users"), createTable("users", createUserTableQuery), createDropFunction("universal_todos"), createTable("universal_todos", createUniversalTodoListTableQuery), createDropFunction("personal_todos"), createTable("personal_todos", createPersonalTodoListTableQuery), endClientConnection];

Also consider using 2 spaces for indentation instead of tabs, some other things can be found here https://www.npmjs.com/package/babel-standard.

Otherwise I like this repo and its idea! I can create a pull-request and fix this if you want... [image: :+1:]

Thanks

— Reply to this email directly or view it on GitHub https://github.com/aybmab/express-redux-sample/issues/1.

Angel Batista Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Class of 2014

aybmab avatar Sep 13 '15 14:09 aybmab

Not intended as a solution, but as this issue hasn't been addressed yet, it's worth pointing that adding an argument to your github url will display the tabs with the desired width: ts=2. E.g: https://github.com/aybmab/express-redux-sample/blob/master/server/models/users.js?ts=2

dimofte avatar Mar 06 '16 16:03 dimofte