An open API service indexing awesome lists of open source software.

https://github.com/codereviewvideos/post-redirect-get-pattern-example

Code to go with the post at https://codereviewvideos.com/post-redirect-get-pattern-example/
https://github.com/codereviewvideos/post-redirect-get-pattern-example

Last synced: about 2 months ago
JSON representation

Code to go with the post at https://codereviewvideos.com/post-redirect-get-pattern-example/

Awesome Lists containing this project

README

        

# Post Redirect Get (PRG) Pattern Implementation

This repository contains [an example implementation of the Post Redirect Get (PRG) pattern](https://codereviewvideos.com/post-redirect-get-pattern-example/) 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:

```bash
git clone https://github.com/codereviewvideos/post-redirect-get-pattern-example.git
```

2. Navigate to the project directory:

```
cd prg-pattern-example
```

3. 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.