4.0.0 • Published 4 years ago
microservice-generator v4.0.0
Microservice Generator
This tool to generate microservice based on swagger, express js and mongoose js which can do CRUD operation using REST APIs.
Use like a node module
$ npm install --save microservice-generator
- import microservice-generator to your project and pass the schema json.
const generator = require('microservice-generator');
var schema = {
"name": "User Details",
"api": "/user",
"port": 3000,
"database": "users",
"schema": {
"name": "String",
"email": {
"type": "String",
"unique": true,
"required": true
},
"password": "String",
"contactNos": [
{
"code": "String",
"number": "Number"
}
],
"gender": "String",
"address": {
"houseNo": "String",
"street": "String",
"city": "String",
"state": "String",
"country": "String",
"pincode": "Number"
}
}
}
generator.createProject(schema);
Use with command line interface
$ npm install -g microservice-generator
$ misgen -h
Usage: misgen [options] <name>
Options:
-V, --version output the version number
-d, --dir Directory name
-h, --help output usage information
# [-d generates microservice for all the schema files in a directory
$ misgen schema.json
#The project folder will be generated at the location of schema.json file
Schema JSON Structure
{
"name":"User Details", //Required. Name of this microservice
"api":"/user", //Optional. API URL of this microservice
"port":3000, //Optional. Port number in which this microservice will be running
"database":"users", //Optional. Name of database in which this microservice will create it's collection
"schema":{
//mongoose schema
}
}
- Example mongoose schema
{
"name": "String",
"email": {
"type": "String",
"unique": true,
"required": true
},
"password": "String",
"contactNos": [
{
"code": "String",
"number": "Number"
}
],
"gender": "String",
"address": {
"houseNo": "String",
"street": "String",
"city": "String",
"state": "String",
"country": "String",
"pincode": "Number"
}
}
License
MIT
4.0.0
4 years ago
3.0.1
5 years ago
3.0.0
5 years ago
2.2.5
6 years ago
2.2.4
6 years ago
2.2.3
6 years ago
2.2.2
6 years ago
2.2.1
6 years ago
2.2.0
6 years ago
2.1.0
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.1.0
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.0
6 years ago