An express react template with tests to learn more about Javascript.
To run the application first install all the dependencies
$ yarn install
- Start the db, I recommend to check the mongo configuration
$ yarn run db
- For development mode
Backend
$ yarn run build:backend
$ yarn run start:backend
Frontend
$ yarn run start
- or for production mode
$ yarn run build:project
To run the test or coverage, the test can be run without mongo installed on the machine
$ yarn run tests
Quick configuration to use mongod with authentication
$ mongod --dbpath "C:\dbpath"
In another console
$ mongod
> use admin
> db.createUser({user: 'username', pwd:'password', roles:[{role:'userAdminAnyDatabase',db: 'admin'}]})
> use <dbname>
> db.createUser({user: 'username', pwd:'password', roles:[{role:'readWrite',db: '<dbname>'}]})
Then we can restart the process of mongod using auth
$ mongod --auth --dbpath "C:\dbpath"
From Integrating Prettier + ESLint + Airbnb Style Guide in VSCode
- Download the ESLint and Prettier extensions for VSCode.
- Install the ESLint and Prettier libraries into our project. In your project’s root directory, you will want to run: npm install -D eslint prettier
- Install the Airbnb config. If you’re using npm 5+, you can run this shortcut to install the config and all of its dependencies: npx install-peerdeps --dev eslint-config-airbnb
- Install eslint-config-prettier (disables formatting for ESLint) and eslint-plugin-prettier (allows ESLint to show formatting errors as we type) npm install -D eslint-config-prettier eslint-plugin-prettier
- Create .eslintrc.json file in your project’s root directory:
{
"extends": ["airbnb", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": ["error"]
},
}
- Create .prettierrc file in your project’s root directory. This will be where you configure your formatting settings. I have added a few of my own preferences below, but I urge you to read more about the Prettier config file
{
"printWidth": 100,
"singleQuote": true
}
- The last step is to make sure Prettier formats on save. Insert "editor.formatOnSave": true into your User Settings in VSCode.
Creating a Node Express-Webpack App with Dev and Prod Builds