# @vdtn359/sequelize-graphql

> A package that automatically generates a readonly graphql server from a Sequelize instance.

Latest version **1.9.0** (published 2022-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vdtn359/sequelize-graphql
pnpm add @vdtn359/sequelize-graphql
yarn add @vdtn359/sequelize-graphql
bun add @vdtn359/sequelize-graphql
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.0 |
| Published | 2022-03-25 |
| First published | 2022-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 301.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | vdtn359 |

## Links

- npm: https://www.npmjs.com/package/@vdtn359/sequelize-graphql
- Repository: https://github.com/tuan231195/sequelize-graphql
- Homepage: https://github.com/tuan231195/sequelize-graphql#readme
- Issues: https://github.com/tuan231195/sequelize-graphql/issues
- npm.io page: https://npm.io/package/@vdtn359/sequelize-graphql

## Dependencies (12)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [typedi](https://npm.io/package/typedi.md) ^0.10.0
- [winston](https://npm.io/package/winston.md) ^3.6.0
- [container](https://npm.io/package/container.md) ^0.0.2
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2
- [dataloader](https://npm.io/package/dataloader.md) ^2.0.0
- [pretty-error](https://npm.io/package/pretty-error.md) ^4.0.0
- [type-graphql](https://npm.io/package/type-graphql.md) ^1.1.1
- [graphql-scalars](https://npm.io/package/graphql-scalars.md) ^1.15.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [graphql-parse-resolve-info](https://npm.io/package/graphql-parse-resolve-info.md) ^4.12.0

## Recent versions

- 1.9.0 (latest) — 2022-03-25
- 1.8.1 — 2022-03-24
- 1.8.0 — 2022-03-24
- 1.7.0 — 2022-03-21
- 1.6.3 — 2022-03-20
- 1.6.2 — 2022-03-20
- 1.6.1 — 2022-03-20
- 1.6.0 — 2022-03-20
- 1.5.17 — 2022-03-19
- 1.5.16 — 2022-03-19
- 1.5.15 — 2022-03-19
- 1.5.14 — 2022-03-19
- 1.5.13 — 2022-03-19
- 1.5.12 — 2022-03-19
- 1.5.11 — 2022-03-18
- … 28 more at https://npm.io/package/@vdtn359/sequelize-graphql/versions

## README

### README.md

A package that automatically generates a readonly graphql server from a Sequelize instance.

### Examples

```
import * as path from 'path';
import { sequelize } from '../sequelize';
import { bootstrap } from '../../src';

bootstrap(sequelize, {
	emitSchemaFile: path.resolve(__dirname, 'schema.gql'),
}).then((apolloServer) => {
	return apolloServer.listen(8080).then(() => {
		console.info('Apollo server is listening on port 8080');
	});
});
```

### Customization:

You can customize the server to have additional resolvers. See examples/advanced:

```
import * as path from 'path';
import { sequelize } from '../sequelize';
import { bootstrap } from '../../src';

bootstrap(sequelize, {
	emitSchemaFile: path.resolve(__dirname, 'schema.gql'),
	extraResolvers: [TestResolver],
	models: {
		user: UserModel,
	},
	resolvers: {
		user: UserResolver,
	},
	filters: {
		user: UserFilter,
	},
}).then((apolloServer) => {
	return apolloServer.listen(8080).then(() => {
		console.info('Apollo server is listening on port 8080');
	});
});
```

### Tests

```
npm run test-integration
```

This run 2 different test suites against sqlite and mysql database

### Demo

Run seed database
```
npm run seed
```

Basic example: ./examples/basic

```
npm run start:basic
```

Advanced example: ./examples/advanced

```
npm run start:advanced
```

### TODO:

* [ ] Aggregations
* [ ] Mutations

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