Coder Social home page Coder Social logo

express-babel-starter's Introduction

Express Babel Starter

A starter scaffold for your express projects using babel so you can take advantage of es6+ features in a nodejs environment This scaffold does not in anyway enforce how you should structure your project. You can tweak it to suit your needs.

Project generated with express-generator.

It's a small improvement over babel's official guide and vmasto's express-babel

What's Included?

  • Expressjs as the web framework
  • Support for es6+(es2015, es2016, es2017....) features thanks to Babel
  • Your codes are automatically polyfilled based on your run time environment by babel-preset-env
  • There's linting option with ESlint
  • Testing with Mocha
  • Config module to store simple project configurations

Getting Started

# Clone the project

git clone https://github.com/benmalcom/express-babel-starter.git

cd express-babel-starter

# Make it your own

rm -rf .git && git init (for windows users, delete .git folder)

# Install dependencies

npm install

If you use Yarn, just replace npm with yarn in the commands.

Start Your development
npm run start:dev

This command starts a nodemon process for your server restart when a code change happens.

Linting

This scaffold uses ESlint. It extends google's eslint config. Feel free to use your own rules or extend any other desirable rule(e.g airbnb) You can run linting in watch mode with:

npm run lint

Note: npm run start:dev starts the server with linting in watch mode, you can remove it if need be.

Testing

This scaffold uses Mocha. It also uses Supertest to demonstrate a simple routing test suite. Feel free to remove the supertest if you don't wish to use it. You can start the test runner in watch mode with:

npm test
Todo
  • Environment Variables
  • Deployment
Disclosure

There has always been debates online whether to use babel-transpilled codes on the server or not. Personally, I think it's fine and I've found this setup to be a sensible approach in doing so. That said, I'd suggest to take anything you read online with a grain of salt and refrain from blindly using boilerplates without first investigating personally. Node is very rapidly converging with the latest ECMAScript specification, and there's mostly full native support for ES2015 and ES2016. The need to transpile on the server is way smaller nowadays, albeit the language is constantly improving and transpiling will probably always be a part of our workflow. At the time of this writing the main benefits are mainly ES6 module syntax and async/await without flags.

This opinion is adapted from vmasto in his express-babel project because I agree with it.

In any case, you can simply remove transpilation and keep everything else that this kit has to offer. If you see anything that needs improvement feel free to open an issue for discussion!

express-babel-starter's People

Contributors

benmalcom avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.