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.
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.
Make sure you have Node.js and npm installed on your machine.
- Clone this repository:
git clone https://github.com/codereviewvideos/post-redirect-get-pattern-example.git
- Navigate to the project directory:
cd prg-pattern-example
- Install dependencies:
npm install
- 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.
Feel free to dive into the codebase to understand the PRG pattern implementation. Check out the views, common controller actions, and example routes.
If you find any issues or have suggestions for improvements, please open an issue or create a pull request. Contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.