Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diy0r/nestjs-file-graph
https://github.com/diy0r/nestjs-file-graph
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/diy0r/nestjs-file-graph
- Owner: DIY0R
- License: mit
- Created: 2024-09-22T13:21:04.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T03:40:59.000Z (3 months ago)
- Last Synced: 2024-10-30T06:25:24.811Z (3 months ago)
- Language: JavaScript
- Size: 1.22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# NestJS File-Graph Wrapper
This package provides a wrapper for integrating the [file-graph](https://www.npmjs.com/package/file-graph) library with NestJS.
## Installation
To install this package, use npm:
```bash
npm install nestjs-file-graph
```## Module Setup
To set up the `nestjs-file-graph` library in your NestJS project, follow these steps:
1. Import `NestjsFileGraph` into your module:
```typescript
import { Module } from '@nestjs/common';
import { NestjsFileGraph } from 'nestjs-file-graph';@Module({
imports: [NestjsFileGraph.forRoot('graph.txt')],
})
export class AppModule {}
```Replace `'graph.txt'` with the path to your file where graph data will be stored.
## Using the Service
After setting up the module, you can use the `FileGraphService` in your controller or service. Here’s an example of usage:
```typescript
import { Controller, Get } from '@nestjs/common';
import { FileGraphService } from 'nestjs-file-graph';@Controller('cats')
export class CatsController {
constructor(private readonly fileGraphService: FileGraphService) {}@Get()
async createAndFindVertex() {
const data = { name: 'Diy0r', city: 'LA' };
const createdVertex = await this.fileGraphService.createVertex(data);
const foundVertex = await this.fileGraphService.findOne(vertex => vertex.id === createdVertex.id);
return foundVertex;
}
}
```
## DocumentationFor detailed documentation on all methods and usage of the [file-graph](https://www.npmjs.com/package/file-graph) library !