mjurincic / express-ES201X-boilerplate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Express.js with Babel Boilerplate

Features:

Getting started

# Clone the project
git clone git@github.com:mjurincic/express-ES2018.git
cd express-ES2018

# Make it your own
rm -rf .git && git init && npm init

# Install dependencies
npm install

# or if you're using Yarn
yarn

Then you can begin development:

# npm
npm run dev

# yarn
yarn run dev

This will launch a nodemon process for automatic server restarts when your code changes.

Testing

Testing is powered by Jest.

# yarn
yarn test

# npm
npm test

You can also generate coverage with:

# npm
npm test -- --coverage

# yarn
yarn test --coverage

Linting

Linting is set up using ESLint. It uses ESLint's default eslint:recommended rules. Feel free to use your own rules and/or extend another popular linting config (e.g. airbnb's or standard).

Begin linting in watch mode with:

# npm
npm run lint

# yarn
yarn run lint

To begin linting and start the server simultaneously, edit the package.json like this:

"dev": "nodemon src/index.js --exec \"node -r babel-register\" | npm run lint"

Environmental variables in development

The project uses dotenv for setting environmental variables during development. Simply copy .env.example, rename it to .env and add your env vars as you see fit.

It is strongly recommended never to check in your .env file to version control. It should only include environment-specific values such as database passwords or API keys used in development. Your production env variables should be different and be set differently depending on your hosting solution. dotenv is only for development.

Deployment

Deployment is specific to hosting platform/provider but generally:

# yarn
yarn run build

# npm
npm run build

will compile your src into /build, and

# yarn
yarn start

# npm
npm start

will run build (via the prestart hook) and start the compiled application from the /build folder.

About

License:MIT License


Languages

Language:JavaScript 57.5%Language:HTML 37.9%Language:CSS 4.6%