0.1.2 • Published 4 years ago

gerjs-express v0.1.2

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

BETA express-gerJs

Use gerJs library plus use the models to validate and reformat the input/ouput payload in the API.

Example : https://github.com/dobobaie/example-express-gerjs-server

Help us to improve the project by contributing 👥

☁️ Installation

$ npm install gerjs-express

📝 Usage

Use gerjs-core documentation to create modelsAPI file.

Initialization

Create a new instance :

Then create the models. Joi is required.

const modelsAPI = require("./models/models");
const gerJs = require("gerjs-express")({
  // same gerjs-core options | except `destinationPath` is not available
  exportTo: 'path/doc', // string ; optional
})(modelsAPI);

⚙️ GerJs initialization in Express side

const express = require("express");

const app = new express();

// please use all the middlewares before
app.use(gerJs.middleware()); // middleware to validate payload and reformat reponse | required

app.
  // routes...
  .get("/swagger", gerJs.expose()) // expose the swagger documentation | optional
  .get("*", (req, res, next) => next(boom.notFound()))
;

👥 Contributing

Please help us to improve the project by contributing :)

❓️ Testing

Clone the repo and run from the project root:

$ npm install
$ npm test
0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.1

4 years ago