Skip to content

Commit

Permalink
Update badge in README
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoBruni committed Feb 11, 2024
1 parent 1caa03b commit 8278164
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Fastify plugin to expose API for Mongoose MongoDB models

[![npm package](https://img.shields.io/npm/v/fastify-mongoose-api.svg)](http://npmjs.org/package/fastify-mongoose-api)
[![Build Status](https://travis-ci.org/jeka-kiselyov/fastify-mongoose-api.svg?branch=master)](https://travis-ci.org/jeka-kiselyov/fastify-mongoose-api)
[![Build workflow](https://github.com/jeka-kiselyov/fastify-mongoose-api/actions/workflows/build.yml/badge.svg)](https://github.com/jeka-kiselyov/fastify-mongoose-api/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/jeka-kiselyov/fastify-mongoose-api/badge.svg?branch=master)](https://coveralls.io/github/jeka-kiselyov/fastify-mongoose-api?branch=master)
[![Dependencies Status](https://david-dm.org/jeka-kiselyov/fastify-mongoose-api/status.svg)](https://david-dm.org/jeka-kiselyov/fastify-mongoose-api)

If you are using [Fastify](https://github.com/fastify/fastify) as your server and [Mongoose](https://github.com/Automattic/mongoose) as your ODM, **fastify-mongoose-api** is the easiest solution to run API server for your models. **fastify-mongoose-api** generates REST routes with refs subroutes like `/api/author/AUTHORID/books` and `/api/books/BOOKID/author` based on MongoDB Mongoose models definitions with few lines of code.

Expand Down Expand Up @@ -126,11 +125,11 @@ fastify.register(fastifyMongooseAPI, {

#### .schemas: array of objects

Enable support for fastify [validation and serialization](#validation-and-serialization). If `.schemaDirPath` is defined, these explicitly defined here have precedence.
Enable support for fastify [validation and serialization](#validation-and-serialization). If `.schemaDirPath` is defined, these explicitly defined here have precedence.

#### .schemaDirPath: string
#### .schemaDirPath: string

Directory where it's possible to define schemas for [validation and serialization](#validation-and-serialization) in separate files. The directory will be trasverse includes all subdirectories.
Directory where it's possible to define schemas for [validation and serialization](#validation-and-serialization) in separate files. The directory will be trasverse includes all subdirectories.

## Sample Application

Expand Down Expand Up @@ -345,7 +344,7 @@ If you are not confidable with fastify validation and serialization logics, see

If you don't set some schemas, API works without validation (except, of course, that inherent in the db schema).

If you wish to add a validation and/or a serialization schema for your api you should add an object to `.schemas` array or set a directory where automatically load schemas with `.schemaDirPath`:
If you wish to add a validation and/or a serialization schema for your api you should add an object to `.schemas` array or set a directory where automatically load schemas with `.schemaDirPath`:

```javascript

Expand All @@ -365,8 +364,8 @@ fastify.register(fastifyMongooseAPI, {
...
},
...
],
schemaDirPath: '/path/to/your/schemas',
],
schemaDirPath: '/path/to/your/schemas',

```
Expand Down Expand Up @@ -460,7 +459,7 @@ const schemas = {
}
};
```
If `.schemas` and `schemaDirPath` are used together, the schemas defined in `.schemas` have precedence to there loaded in `schemaDirPath`.
If `.schemas` and `schemaDirPath` are used together, the schemas defined in `.schemas` have precedence to there loaded in `schemaDirPath`.
The generated validation and serialization is compatible with other plugins like [@fastify/swagger](https://github.com/fastify/fastify-swagger) and [@fastify/swagger-ui](https://github.com/fastify/fastify-swagger-ui) for automatically serving OpenAPI v2/v3 schemas
Expand Down Expand Up @@ -748,4 +747,4 @@ Simply run `npm test` with the COVERALLS_REPO_TOKEN environment variable set and
## License
Licensed under [MIT](./LICENSE)
Licensed under [MIT](./LICENSE)

0 comments on commit 8278164

Please sign in to comment.