Coder Social home page Coder Social logo

moccamc / light-example-4j Goto Github PK

View Code? Open in Web Editor NEW

This project forked from networknt/light-example-4j

0.0 1.0 0.0 1.69 MB

Example APIs or services to demo all feature of the light-4j framework

License: Apache License 2.0

Java 93.14% Shell 3.82% CSS 0.25% HTML 0.48% TypeScript 0.31% JavaScript 1.91% PLSQL 0.09%

light-example-4j's Introduction

light-example-4j

Example APIs to demo all feature of the light-4j and frameworks built on top of light-4j.

light-rest-4j

This is a RESTful API framework which works with OpenAPI specification. The examples are located in rest folder.

petstore

This is a generic service and it is used to test new release and new generator. The following command line will generate the petstore again with new version of light-codegen

cd ~/networknt/light-codegen/codegen-cli
java -jar target/codegen-cli.jar -f light-rest-4j -o ~/networknt/light-example-4j/rest/petstore -m ~/networknt/model-config/rest/petstore/swagger.json -c ~/networknt/model-config/rest/petstore/config.json

light-hybrid-4j

This is a framework support both Monolithic and Microservice at the same time and taking advantages on both sides. The examples are located in hybrid folder.

template server

This is a generic server that can host many light-hybrid-4j services. The following command line will generate this project when a new version of framework is released or the templates are changed. Note that you need to recompile the entire project and regenerate the example when templates are changed.

java -jar target/codegen-cli.jar -f light-hybrid-4j-server -o ~/networknt/light-example-4j/hybrid/server -c ~/networknt/light-codegen/light-hybrid-4j/src/test/resources/serverConfig.json

template service

This is a generic service that delivers a small jar file that can be hosted on light-hybrid-4j-server. The following command line can generate this service when framework is upgraded or templates are Changed.

java -jar target/codegen-cli.jar -f light-hybrid-4j-service -o ~/networknt/light-example-4j/hybrid/service -m ~/networknt/light-codegen/light-hybrid-4j/src/test/resources/schema.json -c ~/networknt/light-codegen/light-hybrid-4j/src/test/resources/serviceConfig.json

Now you can deploy the service to server platform and test it.

cd ~/networknt/light-example-4j/hybrid/service
mvn clean install
cd ..
cd server
mvn clean install
cp ../service/target/petstore-1.0.1.jar .
java -cp petstore-1.0.1.jar:target/petstore-1.0.1.jar com.networknt.server.Server

Now issue the following curl command to test the service.

curl -X POST \
  http://localhost:8080/api/json \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 58bb63eb-de70-b855-a633-5b043bb52c95' \
  -d '{
  "host": "lightapi.net",
  "service": "world",
  "action": "hello",
  "version": "0.1.1",
  "lastName": "Hu",
  "firstName": "Steve"
}'

light-example-4j's People

Contributors

stevehu avatar gavinchenyan avatar greenlaw110 avatar irus avatar hydra1983 avatar birdstudiocn avatar cortwave avatar jknack avatar jww0924 avatar

Watchers

Teerayut avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.