2.0.0 • Published 7 years ago
generator-cf-node-server v2.0.0
generator-cf-node-server
Yeoman generator plugin for NodeJS micro-service scaffolding on Cloud Foundry.
Installation steps:
- First, install Yeoman and generator-cf-node-server using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-cf-node-server- Next, provide the necessary inputs to generate your NodeJS micro-service scaffolding.
yo cf-node-server- Thats's it. You are ready to go!!
Highlights of the micro-service scaffolding project:
- Option to integrate Express or Koa as the web application framework.
- Supports OpenAPI Specification V3.
- Auto generates stubs (controller & service classes) based on Open API Specification V3.
- Provides sample GET, PUT, POST request based on OpenAPI Specification V3.
- Provides out-of-the box '/health' API.
- Ready to deploy on Cloud Foundry.
Getting To Know Yeoman
- Yeoman has a heart of gold.
- Yeoman is a person with feelings and opinions, but is very easy to work with.
- Yeoman can be too opinionated at times but is easily convinced not to be.
Feel free to learn more about Yeoman.
About the generated microservice scaffolding
Supports OpenAPI Specification V3
Path for your API definition:
/apiDefinition/openapi.jsonAuto generates stubs (controller & service classes) based on Open API Specification V3.
Step 1 - Define your own API:
/apiDefinition/openapi.jsonStep 2 - Verify file content using Swagger UI (Swagger Editor):
Step 3 - Generate relevant controller and service classes:
npm run stubStep 4 - Controller and service classes will be generated in:
/src/controllers
/src/servicesProvides sample GET, PUT, POST request based on OpenAPI Specification V3
As a ready example, try the '/sample' endpoint already defined in:
/apiDefinition/openapi.jsonStep 1 - Generate relevant controller and service classes for '/sample' endpoint:
npm run stubStep 2 - Run the server locally:
npm run local-startStep 3 - Verify GET '/sample' API:
http://localhost:3000/sampleProvides out-of-the box health endpoint
Step 1 - Run the server locally:
npm run startStep 2 - Verify application health:
http://localhost:3000/healthReady to deploy to Cloud Foundry
To deploy the app to Cloud Foundry:
cf push -f manifest.ymlLicense
MIT © Kaustuv Mukherjee