Skip to content

sotayamashita/express-starter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express Starter

Create Node apps using the Express framework with zero initial configuration. express-starter is built using Neutrino to harness the power of Webpack with the simplicity of presets.

Features

  • Zero upfront configuration necessary to start developing and building an Express project
  • Extends from neutrino-preset-node
    • Modern Babel compilation supporting ES modules, Node.js 6.9+, and async functions
    • Auto-wired sourcemaps
    • Chunking of external dependencies apart from application code
    • Easily extensible to customize your project as needed
  • Extends from neutrino-preset-airbnb-base
    • Zero upfront configuration necessary to start linting your project
    • Modern Babel knowledge supporting ES modules, JSX, Web and Node.js apps
    • Highly visible during development, fails compilation when building for production
    • Easily extensible to customize your project as needed

Requirements

  • Node.js v6.9+
  • Yarn or npm client

Installation

To get you started fork and clone the express-starter repository and install the dependencies using Yarn or the npm client.

cd express-starter/
❯ yarn

Quick start

Start the app with yarn serve, then open a browser to http://localhost:3000.

Yarn

❯ yarn serve
Warning: This preset does not support watch compilation. Falling back to a one-time build.
Hash: 51bbc06d11fbccda1897
Version: webpack 2.2.1
Time: 981ms
       Asset     Size  Chunks             Chunk Names
    index.js  3.66 kB       0  [emitted]  index
index.js.map  3.54 kB       0  [emitted]  index
✨  Done in 2.05s.
Running on :3000

npm

❯ npm run serve
Warning: This preset does not support watch compilation. Falling back to a one-time build.
Hash: 51bbc06d11fbccda1897
Version: webpack 2.2.1
Time: 981ms
       Asset     Size  Chunks             Chunk Names
    index.js  3.66 kB       0  [emitted]  index
index.js.map  3.54 kB       0  [emitted]  index
✨  Done in 2.05s.
Running on :3000

Important Note: At the time of writing, Neutrino's Node preset does not support watch compilation; it will instead fall back to running a build with the NODE_ENV environment variable set to development.

Building

express-starter builds static assets to the build directory by default when running yarn build.

❯ yarn build
clean-webpack-plugin: /Users/hassanali/Documents/Mozilla/projects/express-starter/build has been removed.
Build completed in 0.715s

Hash: 51bbc06d11fbccda1897
Version: webpack 2.2.1
Time: 721ms
       Asset     Size  Chunks             Chunk Names
    index.js  3.66 kB       0  [emitted]  index
index.js.map  3.54 kB       0  [emitted]  index
✨  Done in 1.48s.

Running Tests

In order to keep this starter kit minimalist, express-starter has no test runner configured, however adding one is incredible easy with Neutrino. Refer to the relevant section on building and running tests.

Customizing

To override the build configuration, start with the documentation on customization. neutrino-preset-node creates some conventions to make overriding the configuration easier once you are ready to make changes.

By default the Node.js preset creates a single main index entry point to your application, and this maps to the index.js file in the src directory. This means that the Node.js preset is optimized toward a main entry to your app. Code not imported in the hierarchy of the index entry will not be output to the bundle. To overcome this you must either define more entry points, or import the code path somewhere along the index hierarchy.

Vendoring

express-starter uses neutrino-preset-node. The latter automatically vendors all external dependencies into a separate chunk based on their inclusion in your package.json. No extra work is required to make this work.

Rules

Refer to the list of rules and their identifers which can be overridden.

Plugins

Refer to the list of plugins and their identifiers which can be overridden.

Simple customization

By following the customization guide and knowing the rule, loader, and plugin IDs above, you can override and augment the build directly from package.json.

Example: Allow importing modules with an .mjs extension.

{
  "config": {
    "neutrino": {
      "resolve": {
        "extensions": [
          ".mjs"
        ]
      }
    }
  }
}

Advanced configuration

By following the customization guide and knowing the rule, loader, and plugin IDs above, you can override and augment the build by creating a JS module which overrides the config.

Example: Allow importing modules with an .mjs extension.

module.exports = neutrino => {
  neutrino.config.resolve.extensions.add('.mjs');
};

Contributing

Thank you for wanting to help out with Neutrino! We are very happy that you want to contribute, and have put together the contributing guide to help you get started. We want to do our best to help you make successful contributions and be part of our community.

About

Express Starter Kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%