Skip to content

Commit beb8310

Browse files
authored
Added webpack demo (#969)
1 parent d199f99 commit beb8310

File tree

7 files changed

+1517
-3
lines changed

7 files changed

+1517
-3
lines changed

pgml-sdks/pgml/javascript/examples/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Webpack Demo
2+
3+
The JavaScript SDK utilizes native node modules as our SDK is written in Rust. To get it working with webpack, we need a loader that is designed to work with native node modules. In this case, we have opted to use the [node-loader](https://github.com/webpack-contrib/node-loader) module. See [webpack.config.js](./webpack.config.js) for how we configured it.
4+
5+
## Prerequisites
6+
7+
Before running, first install dependencies and set the DATABASE_URL environment variable:
8+
```
9+
npm i
10+
export DATABASE_URL={YOUR DATABASE URL}
11+
```
12+
13+
Optionally, configure a .env file containing a DATABASE_URL variable.
14+
15+
## Running the Example
16+
17+
The example utilizes the Builtins class to perform text classification. After following the [Prerequisites](#/Prerequisites) run the following code:
18+
```
19+
npm run build
20+
node dist/index.js "I love PostgresML"
21+
```

0 commit comments

Comments
 (0)