Skip to content

Commit f07375a

Browse files
authored
Release v1.0.2 (#1)
* - use Object.assign instead of lodash/merge - refactor test config
1 parent 562f043 commit f07375a

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ It is written in Javascript ES6 syntax and it is further transpiled down to Java
2929
app.use(expressApiVersioning({
3030
instance: app, // passes an instance of express to the entry point
3131
apiPath: path.join(__dirname, './api'), // absolute path to the api directory
32-
test: /\/api\/(v[0-9]+)[a-z0-9/_+-]*/, // regular expression to get the version number from the url
32+
test: /\/api\/(v[0-9]+).*/, // regular expression to get the version number from the url
3333
entryPoint: 'app.js' // entry point exports a function which takes an instance of express as parameter.
3434
}));
3535
```
@@ -39,7 +39,7 @@ app.use(expressApiVersioning({
3939
app.use(expressApiVersioning({
4040
instance: app, // passes an instance of express to the entry point
4141
apiPath: path.join(__dirname, './api'), // absolute path to the api directory
42-
test: /\/endpoint\/(v[0-9]+)[a-z0-9/_+-]*/, // regular expression to get the version number from the url,
42+
test: /\/endpoint\/(v[0-9]+).*/, // regular expression to get the version number from the url,
4343
entryPoint: 'index.js' // entry point exports a function which takes an instance of express as parameter.
4444
}));
4545
```
@@ -62,7 +62,7 @@ Please use the [issues](/issues) page to report an issue.
6262

6363
| Configuration item | Default | Description |
6464
| ------ | ------ | ------- |
65-
| test | /\/api\/(v[0-9]+)[a-z0-9/_+-]*/ | Regular expression to get the version number from the request url. It gets the version number from the first group of the regex match.
65+
| test | `/\/api\/(v[0-9]+)[a-z0-9/_+-]*/`| Regular expression to get the version number from the request url. It gets the version number from the first group of the regex match.
6666
| entryPoint | app.js | Entry point for each api version. It exports a function which takes an instance of express as parameter.
6767
| apiPath | empty string | Absolute path to each api version container/directory. This is usually `path.join(__dirname, './api')`.
6868
| instance | null | An instance of express app which will be passed down to the entry point for usage.
@@ -77,7 +77,7 @@ Please use the [issues](/issues) page to report an issue.
7777

7878
# Testing
7979

80-
If you will like to test this package,
80+
To test this package,
8181
- Clone this repo or `npm install express-api-versioning`
8282
- cd into the package directory and run `npm install`
8383
- Then run `npm test` to run the test.

package-lock.json

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

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-api-versioning",
3-
"version": "1.0.0",
3+
"version": "1.0.2",
44
"description": "Express API versioning is an express middleware that dynamically loads different API versions seamlessly depending on the version number specified in the request url.",
55
"bugs": "https://github.com/adesege/express-api-versioning/issues",
66
"peerDependencies": {
@@ -42,7 +42,6 @@
4242
"babel-preset-env": "^1.6.0",
4343
"chai": "^4.1.2",
4444
"express": "^4.15.5",
45-
"lodash": "^4.17.4",
4645
"supertest": "^3.0.0"
4746
},
4847
"nyc": {

src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import mergeConfig from 'lodash/merge';
21
import path from 'path';
32
import fs from 'fs';
43
import { Exception } from './utils/exception';
54

65
export default (config) => {
76
// define default configuration options
87
const defaultConfig = {
9-
test: /\/api\/(v[0-9]+)[a-z0-9/_+-]*/,
8+
test: /\/api\/(v[0-9]+).*/,
109
entryPoint: 'app.js',
1110
apiPath: '',
1211
instance: null
1312
};
1413

1514
// merge default configuration options with user defined config options
16-
const mergedConfig = mergeConfig(defaultConfig, config);
15+
const mergedConfig = Object.assign({}, defaultConfig, config);
1716

1817
// get config options from merged configs
1918
const {

0 commit comments

Comments
 (0)