Skip to content

codereviewvideos/post-redirect-get-pattern-example

Repository files navigation

Post Redirect Get (PRG) Pattern Implementation

This repository contains an example implementation of the Post Redirect Get (PRG) pattern in web development using NodeJS, Express, TypeScript, Nunjucks, and Gov UK front end. The PRG pattern is a design approach that ensures secure handling of form submissions in web applications.

Overview

In this project, we cover the following key aspects:

  • Explanation of the PRG pattern and its benefits.
  • Implementation of a simple website with two journeys using the PRG pattern.
  • Example views and common controller actions for both approaches (with and without PRG).
  • Clear demonstration of how PRG prevents duplicate form submissions and enhances user experience.

Getting Started

Prerequisites

Make sure you have Node.js and npm installed on your machine.

Installation

  1. Clone this repository:
git clone https://github.com/codereviewvideos/post-redirect-get-pattern-example.git
  1. Navigate to the project directory:
cd prg-pattern-example
  1. Install dependencies:
npm install

Usage

  1. Run the Application

Start the Node.js server:

npm run start:dev

Visit http://localhost:3000 in your browser to explore the PRG pattern implementation.

Explore the Code

Feel free to dive into the codebase to understand the PRG pattern implementation. Check out the views, common controller actions, and example routes.

Contributing

If you find any issues or have suggestions for improvements, please open an issue or create a pull request. Contributions are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.