Skip to content

Commit 41bfafe

Browse files
committed
init
0 parents  commit 41bfafe

17 files changed

+11527
-0
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# @see https://editorconfig-specification.readthedocs.io/en/latest/
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 2
12+
charset = utf-8
13+
14+
# 4 space indentation
15+
[*.py]
16+
indent_style = space
17+
indent_size = 4
18+
19+
# Tab indentation (no size specified)
20+
[Makefile]
21+
indent_style = tab

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# @see https://git-scm.com/docs/gitignore
2+
3+
# `.DS_Store` is a file that stores custom attributes of its containing folder
4+
.DS_Store
5+
6+
# Logs
7+
logs
8+
*.log
9+
10+
# Dependencies
11+
node_modules
12+
bower_components
13+
vendor
14+
15+
# Caches
16+
.cache
17+
.npm
18+
.eslintcache
19+
20+
# Temporaries
21+
.tmp
22+
.temp
23+
24+
# Built
25+
dist
26+
target
27+
built
28+
output
29+
out

.templates/.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# @see https://editorconfig-specification.readthedocs.io/en/latest/
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 2
12+
charset = utf-8
13+
14+
# 4 space indentation
15+
[*.py]
16+
indent_style = space
17+
indent_size = 4
18+
19+
# Tab indentation (no size specified)
20+
[Makefile]
21+
indent_style = tab

.templates/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# @see https://git-scm.com/docs/gitignore
2+
3+
# `.DS_Store` is a file that stores custom attributes of its containing folder
4+
.DS_Store
5+
6+
# Logs
7+
logs
8+
*.log
9+
10+
# Dependencies
11+
node_modules
12+
bower_components
13+
vendor
14+
15+
# Caches
16+
.cache
17+
.npm
18+
.eslintcache
19+
20+
# Temporaries
21+
.tmp
22+
.temp
23+
24+
# Built
25+
dist
26+
target
27+
built
28+
output
29+
out
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
import classNames from "classnames/bind";
3+
4+
import styles from "./index.scss";
5+
6+
const cx = classNames.bind(styles);
7+
8+
function __templateNameToPascalCase__() {
9+
return <div className={cx("__templateNameToParamCase__")}>Hello :)</div>;
10+
}
11+
12+
export default __templateNameToPascalCase__;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.__templateNameToParamCase__ {
2+
display: inline-block;
3+
}

.templates/template-sample/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default function __templateNameToPascalCase__() {
2+
console.log("TemplateName -> __templateName__");
3+
console.log("TemplateName to ParamCase -> __templateNameToParamCase__");
4+
console.log("TemplateName to PascalCase -> __templateNameToPascalCase__");
5+
}

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Next.js HTTP Proxy Middleware
2+
3+
HTTP Proxy middleware available in API Middleware provided by Next.js.
4+
5+
## Installation
6+
7+
The easiest way to install `next-http-proxy-middleware` is with [npm](https://www.npmjs.com/).
8+
9+
```bash
10+
11+
npm install next-http-proxy-middleware
12+
13+
```
14+
15+
Alternately, download the source.
16+
17+
```bash
18+
19+
git clone https://github.com/stegano/next-http-proxy-middleware.git
20+
21+
```
22+
23+
## Features
24+
25+
This middleware is implemented using the [`http-proxy`](https://www.npmjs.com/package/http-proxy) library. You can use the existing options provided by `http-proxy`. And you can rewrite the api path using `pathRewrite`, an additional option provided by this middleware.
26+
27+
- [http-proxy options](https://www.npmjs.com/package/http-proxy#options)
28+
29+
## Examples
30+
31+
- Refer to the following for how to use Nextjs API Middleware
32+
33+
- [Next.js API Middlewares Guide](https://nextjs.org/docs/api-routes/api-middlewares)
34+
35+
```typescript
36+
// pages/[...all].ts
37+
...
38+
export default (req: NextApiRequest, res: NextApiResponse) => (
39+
isDevelopment
40+
? httpProxyMiddleware(req, res, {
41+
target: 'https://www.example.com',
42+
pathRewrite: {
43+
'^/api/new': '/v2', // `/api/new/test` -> `/v2/test`
44+
'^/api': '', // `/api/test` -> `/test`
45+
},
46+
})
47+
: res.status(404).send(null)
48+
);
49+
```

build/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)