Skip to content

Commit

Permalink
Merge branch '07-fflip-feature-toggles' of github.com:jverhoelen/node…
Browse files Browse the repository at this point in the history
…-express-typescript-boilerplate into 08–environment-configuration
  • Loading branch information
Jonas Verhoelen committed May 22, 2019
2 parents 27447e9 + 8ae7d0d commit 8a717ab
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 8 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## node-express-typescript-recipes
## node-express-typescript-boilerplate

Have a look at the [docs](./docs/) which state of the application is available on this branch.
This is a boilerplate project for web applications including both backend and frontend using Node.js, Express.js and TypeScript.

It is built up stepwise. The steps are reflected in individual branches. Each branch introduces a new topic and implements few examples.

### Steps aka branches

* [01 – Initial Setup](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/01-setup)
* [02 – Express.js Middlewares and Request Handlers](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/02-express-middlewares-and-request-handlers)
* [03 – Code Structure and Design](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/03-server-application-design)
* [04 – Unit and Integration Testing](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/04-unit-and-integration-tests)
* [05 – Minimal Frontend, Isomorphic Bundles, Shared Code](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/05-frontend-and-isomorphic-bundles)
* [06 – Web Security and Rate Limiting](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/06-web-security-and-rate-limiting)
* [07 – Feature Toggles and Criteria using fflip](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/07-fflip-feature-toggles)
* [08 – Configuration by Environment Variables](https://github.com/jverhoelen/node-express-typescript-boilerplate/tree/08–environment-configuration)

There are [open Pull Requests showing the diff for each step](https://github.com/jverhoelen/node-express-typescript-boilerplate/pulls) compared to its previous step. The `master` branch is default and points to the branch of the last recent step.

### What to do with a step aka branch?

You should read the article series I wrote about building up this project :blue_book: Each article is available in :gb: and :de:

1. Part 1 (Steps 1-5) – [English :gb:](https://blog.codecentric.de/en/2019/05/web-app-node-js-express-js-typescript/)[German :de:](https://blog.codecentric.de/2019/05/web-anwendungen-mit-node-express-typescript-entwickeln/)
2. Part 2 (Steps 6-8) – *In progress*
3. Part 3 (Steps 9-X) – *Soon in progress*

In addition, have a look at the [docs folder](./docs/) on the branches. The files contain information on added NPM scripts and how the changes can be tried out.
32 changes: 32 additions & 0 deletions pull-setup-commits-upwards.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
git checkout 02-express-middlewares-and-request-handlers
git pull --rebase origin 01-setup
git push

git checkout 03-server-application-design
git pull --rebase origin 02-express-middlewares-and-request-handlers
git push

git checkout 04-unit-and-integration-tests
git pull --rebase origin 03-server-application-design
git push

git checkout 05-frontend-and-isomorphic-bundles
git pull --rebase origin 04-unit-and-integration-tests
git push

git checkout 06-web-security-and-rate-limiting
git pull --rebase origin 05-frontend-and-isomorphic-bundles
git push

git checkout 07-fflip-feature-toggles
git pull --rebase origin 06-web-security-and-rate-limiting
git push

git checkout 08–environment-configuration
git pull --rebase origin 07-fflip-feature-toggles
git push

git checkout master
git pull --rebase origin 08–environment-configuration
git push

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import * as FFlipExpressIntegration from 'fflip-express'
import { criteria } from './criteria'
import { features } from './features'

const createFFlipExpressIntegration = () => new FFlipExpressIntegration(fflip, {
cookieName: 'fflip',
manualRoutePath: '/api/toggles/local/:name/:action'
})

export const applyFeatureToggles = (server: Express) => {
fflip.config({ criteria, features })
const fflipExpressIntegration = createFFlipExpressIntegration()
const fflipExpressIntegration = new FFlipExpressIntegration(fflip, {
cookieName: 'fflip',
manualRoutePath: '/api/toggles/local/:name/:action'
})

server.use(fflipExpressIntegration.middleware)
server.use((req: Request, _: Response, next: NextFunction) => {
Expand Down

0 comments on commit 8a717ab

Please sign in to comment.