Skip to content

Commit 095e020

Browse files
authored
Sander/implement proxy (#294)
* feat(testdataserver): a local server to replace typycode * improvement(testdate into source): move testdata into source of Scully * feat(proxy): added proxy server support to scully * fix(version): fix version for tests sometimes the version would be undefined in tests, this fixes that
1 parent dbdfc89 commit 095e020

21 files changed

+1305
-70
lines changed

cypress/integration/sampleBlog.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ context('check first integration test', () => {
2828

2929
it('Check if users dont call httprequest', () => {
3030
cy.server();
31-
cy.route('https://jsonplaceholder.typicode.com/users', {
31+
cy.route('http://localhost:8200/users', {
3232
onRequest: req => {
3333
cy.log('Call http done');
3434
expect(true).to.equal(false);

docs/plugins.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ exports.config = {
195195
};
196196
```
197197

198-
The following is an example that uses the [jsonplaceholder](https://jsonplaceholder.typicode.com/) to fetch a list of
198+
The following is an example that uses the [jsonplaceholder](http://localhost:8200/) to fetch a list of
199199
User IDs for my app. It uses the [JSON Plugin](../scully/routerPlugins/jsonRoutePlugin.ts) which is already part of Scully.
200200

201201
```javascript
@@ -206,7 +206,7 @@ exports.config = {
206206
'/user/:userId': {
207207
type: 'json',
208208
userId: {
209-
url: 'https://jsonplaceholder.typicode.com/users',
209+
url: 'http://localhost:8200/users',
210210
property: 'id',
211211
},
212212
},

docs/scully-cmd-line.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Scully CLI has the following options available:
1010
- [configFile](#configfile)
1111
- [project](#project)
1212
- [baseFilter](#basefilter)
13+
- [proxyConfig](proxyconfig)
1314
- [removeStaticDist](#removestaticdist)
1415
- [open](#open)
1516
- [ssl](#ssl)
@@ -64,6 +65,10 @@ npx scully --baseFilter /someRoute
6465

6566
Alias `--bf`. This enable to Scully to start to render an specific route.
6667

68+
## proxyConfig
69+
70+
Alias `--proxy` takes a relative filename filename for a proxy config file. for details look at [this](https://github.com/chimurai/http-proxy-middleware/blob/master/README.md). We use the same config format as [webpackDevServer](https://webpack.js.org/configuration/dev-server/#devserverproxy)
71+
6772
## removeStaticDist
6873

6974
```bash

docs/scully-configuration.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ or teach to the community how to combine scully with others tools.
1414
- [homeFolder](#homefolder)
1515
- [outDir](#outdir)
1616
- [distFolder](#distfolder)
17+
- [proxyConfig](proxyConfig)
1718
- [routes](#routes)
1819
- [handled Routes](#handled-routes)
1920
- [unhandled Routes](#unhandled-routes)
2021
- [extraRoutes](#extraroutes)
2122
- [appPort](#appport)
2223
- [staticport](#staticport)
24+
- [proxyConfig](#proxyconfig)
2325
- [puppeteerLaunchOptions](#puppeteerlaunchoptions)
2426
- [hostName](#hostname)
2527
- [hostUrl](#hosturl)
28+
- [guessParserOptions](#guessparseroptions)
2629

2730
## `ScullyConfig` Interface
2831

@@ -97,6 +100,10 @@ handled routes reference to routes with dynamic data.
97100
/foo/:id
98101
```
99102

103+
## proxyConfig
104+
105+
Takes a relative filename filename for a proxy config file. for details look at [this](https://github.com/chimurai/http-proxy-middleware/blob/master/README.md). We use the same config format as [webpackDevServer](https://webpack.js.org/configuration/dev-server/#devserverproxy)
106+
100107
`routes` is a reference to all unhandled routes which scully will transform to handled, using plugins.
101108
If you want to know more about plugins go to [Plugins](plugins.md) section.
102109

@@ -125,6 +132,10 @@ which will serve static files compiled by Scully.
125132

126133
The port by default is: `1668`
127134

135+
### proxyConfig
136+
137+
Optional, when you need a proxy, we can read the proxy config file that is also used by the [Angular CLI](https://angular.io/guide/build#proxying-to-a-backend-server)
138+
128139
### puppeteerLaunchOptions
129140

130141
When in a restricted environment there is a change the default options for puppeteer won't work. In such a case

0 commit comments

Comments
 (0)