Skip to content

Commit c731e8f

Browse files
committed
feat: initial nodejs client, with notify and identify calls
0 parents  commit c731e8f

18 files changed

+12612
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.npmrc
2+
node_modules
3+
yarn-error.log
4+
dist

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": false,
3+
"trailingComma": "all"
4+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Knock Labs, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Knock Node.js library
2+
3+
Knock API access for applications written in server-side Javascript.
4+
5+
## Documentation
6+
7+
See the [documentation](https://docs.knock.app) for Node.js usage examples.
8+
9+
## Installation
10+
11+
```bash
12+
npm install @knocklabs/node
13+
```
14+
15+
## Configuration
16+
17+
To use the library you must provide a secret API key, provided in the Knock dashboard.
18+
19+
You can set it as an environment variable:
20+
21+
```bash
22+
KNOCK_API_KEY="sk_12345"
23+
```
24+
25+
Or, you can set it before your application starts:
26+
27+
```javascript
28+
const Knock = require("@knocklabs/node");
29+
30+
const knockClient = new Knock("sk_12345");
31+
```

jest.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
clearMocks: true,
3+
resetMocks: true,
4+
restoreMocks: true,
5+
verbose: true,
6+
testEnvironment: "node",
7+
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
8+
roots: ["<rootDir>/src"],
9+
transform: {
10+
"^.+\\.ts?$": "ts-jest",
11+
},
12+
};

0 commit comments

Comments
 (0)