Skip to content

Commit

Permalink
chore: improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Nov 3, 2023
1 parent edf33c5 commit 75ce71a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# next-nginx-routes

Generate Nginx routes configuration file for Next.js static HMTL export.
Generate Nginx routes configuration file for Next.js static HMTL export, also known as `output: export`.

This [NPM package](https://www.npmjs.com/package/next-nginx-routes) allows you to convert Next.js routes like:
This dependency-free [NPM package](https://www.npmjs.com/package/next-nginx-routes) provides a NPM script to convert all your Next.js routes like:

```json
{
Expand All @@ -21,6 +21,8 @@ location ~ ^/([^/]+?)(?:/)?$ {
}
```

Note: currently only Next.js pages router is fully supported.

## Getting started

### Installation
Expand All @@ -31,23 +33,23 @@ yarn add --dev next-nginx-routes

### Generate Nginx configuration file

Add next-nginx-routes to your export script:
Add next-nginx-routes to your build script:

```json
{
"export": "next build && next export && next-nginx-routes"
"build": "next build && next-nginx-routes"
}
```

And run Next.js export:

```shell
yarn run export
yarn run build
```

### Include Nginx configuration file

Finally include the generated configuration file `next-routes.conf` and the Next.js output in your Nginx site configuration file.
Finally include the generated configuration file `next-routes.conf` in your Nginx site configuration file and make the Next.js `out` directory available to Nginx.

## Requirements

Expand Down
10 changes: 5 additions & 5 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ Install all dependencies:
yarn install
```

### Export
### Next.js build

Run Next.js static HTML export:
Run Next.js build and generate Nginx routes configuration file:

```shell
yarn run export
yarn run build
```

### Build
### Docker build

Build Docker image:

```shell
docker build -t next-nginx-routes-example .
```

### Run
### Docker run

Start Docker container and open [localhost:8080](http://localhost:8080) in your browser:

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Generate Nginx routing configuration for static Next.js projects.",
"version": "1.1.1",
"keywords": [
"export",
"Next.js",
"Nginx",
"configuration",
Expand Down

0 comments on commit 75ce71a

Please sign in to comment.