# photon-ve

> This example shows how to use [Photon JS](https://photonjs.prisma.io/) in a **simple TypeScript script** to read and write data in a database.

Latest version **1.0.1** (published 2019-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install photon-ve
pnpm add photon-ve
yarn add photon-ve
bun add photon-ve
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-07-27 |
| First published | 2019-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 46.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Maintainers | vedaterenoglu |

## Links

- npm: https://www.npmjs.com/package/photon-ve
- npm.io page: https://npm.io/package/photon-ve

## Recent versions

- 1.0.1 (latest) — 2019-07-27

## README

# Simple TypeScript Script Example

This example shows how to use [Photon JS](https://photonjs.prisma.io/) in a **simple TypeScript script** to read and write data in a database.

## How to use

### 1. Download example & install dependencies

Clone the repository:

```sh
git clone git@github.com:prisma/photonjs.git
```

Install Node dependencies:

```sh
cd photonjs/examples/typescript/script
npm install
```

### 2. Install the Prisma 2 CLI

To run the example, you need the [Prisma 2 CLI](https://github.com/prisma/prisma2/blob/master/docs/prisma-2-cli.md):

```sh
npm install -g prisma2
```

### 3. Set up database

For this example, you'll use a simple [SQLite database](https://www.sqlite.org/index.html). To set up your database, run:

```sh
prisma2 lift save --name 'init'
prisma2 lift up
```

You can now use the [SQLite Browser](https://sqlitebrowser.org/) to view and edit your data in the `./prisma/dev.db` file that was created when you ran `prisma2 lift up`.

### 4. Generate Photon (type-safe database client)

Run the following command to generate [Photon JS](https://photonjs.prisma.io/):

```sh
prisma2 generate
```

Now you can seed your database using the `seed` script from `package.json`:

### 4. Seed the database data with this script

Execute the script with this command:

```sh
npm run seed
```

### 5. Run the script

Execute the script with this command:

```sh
npm run start
```

## Next steps

- Read the [Prisma 2 announcement](https://www.prisma.io/blog/announcing-prisma-2-zq1s745db8i5/)
- Check out the [Prisma 2 docs](https://github.com/prisma/prisma2)
- Share your feedback in the [`prisma2-preview`](https://prisma.slack.com/messages/CKQTGR6T0/) channel on the Prisma Slack

---
_Source: https://npm.io/package/photon-ve · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
