Giter Club home page Giter Club logo

express-demo's Introduction

Express

Introduction

This POC will explore a server-side rendered application using Express, which is a popular web application framework for Node.js, combined with express-handlebars as a templating language. The front-end will use vanilla CSS and JavaScript.

Objectives

Explore server-side rendering using Express. I will predominantly be looking at:

  • Scalability
  • Maintainability
  • Performance
  • Configurability

POC

The application uses these mock API calls:

It uses Express for:

The Politics and News pages use middleware to filter out the data from the list. In a real world scenario you would fetch this data pre-filtered from an API, this is something simple to demonstrate middleware.

The front-end uses vanilla JavaScript and CSS (combined and prefixed using PostCSS).

Outcome

Pros

  • Can be combined with multiple view engines, allowing the use of templates, partials, components etc.
  • Can be used in conjunction with a FE framework (if required)
  • Express has good support - it's the most popular Node.js framework and is widely adopted by companies like Uber and IBM. There's a lot of middleware that can be used
  • Less maintenance overhead as a frameworks' SSR solution often ships with client-side updates which can have an maintenance overhead as new versions are released
  • Is not married to a client-side solution so the client-side JavaScript budget can be used elsewhere
  • Consistency - both the back-end and front-end use the same language
  • Performant - only write what we need

Cons

  • Nothing "out of the box", everything must be built custom
  • Requires architectural consideration to establish scability best practices and patterns

Improvements

  • Integrate with CDN, at the moment the demo emulates a stale cache response

Resources

Rendering

Most content should be served through a CDN with a reasonable TTL. For cached content:

Cached Content

For stale content:

Stale Content

Running the project

# Install dependencies
$ npm install

# Run development mode
$ npm run dev

# Watchers for FE code
$ npm run watch

# Production build
$ npm run build

express-demo's People

Contributors

chrisboakes avatar chrishanes avatar

Watchers

 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.