Skip to content

Microstarter CLI 0.2.6

Choose a tag to compare

@hashimati hashimati released this 11 Mar 19:26
· 16 commits to master since this release

To install it, copy the "mc.bat," "mc," and "mc.jar" files to your Micronaut Project or configure their files in your environment. Then, the "mc" command will be ready to use.

Pre-Requisite

Java 11+

New Features:

  1. Supporting Micronaut Security API Key.
  2. Bug Fixes: Fixing Flyway.

Generating API Key Demo:

  1. Generate a Micronaut application using the init command:
> mc init --name apikey --package io.hashimati --lang GROOVY
  1. Run the configure command:
> mc configure

Enter the configuration as follows:

Is the application monolithic? yes
? Enter the server port number between 0 - 65535:  8080
? Enter the service id:  apikey-demo
? Select Reactive Framework:  reactor
? Select Annotation:  Micronaut
? Enter the database name:  apikeys
? Select Database Type:  H2
? Select Database Backend:  JDBC
? Select Data Migration:  liquibase
? Select Messaging type:  none
? Do you want to add cache-caffeine support? yes
? Do you want to add Micrometer feature? yes
? Select Distributed Tracing:  Jaeger
? Do you want to add GraphQL-Java-Tools support? yes
? Do you want to add GRPC support? no
? Do you want to use File Services? no
? Do you want to configure VIEWS? no
  1. Run the apikey command:
    apikey command is a subcommand of the security command. run the apikey command as follows
> mc security apikey

Set the key name to MY-TOKEN

? Enter the header name:  MY-TOKEN

Testing the demo using .http

POST http://localhost:8080/api/security/apikey/generateKey
Content-Type: application/json

{
  "name": "Ahmed",
  "password": "HelloWorld"
}
//This request will generate the token, use it in the next requests by passing it in the My-Token header.
###
POST http://localhost:8080/api/v1/fruit/save
Content-Type: application/json
My-Token: sQGXT7jtRpraam0Qr4Ytlu4ixk45hl2kmnT5bKnbknIYtGwsvm7K1Fpv3knYqk98

{
  "name": "Apple"
}

###

GET http://localhost:8080/api/v1/fruit/findAll
My-Token: sQGXT7jtRpraam0Qr4Ytlu4ixk45hl2kmnT5bKnbknIYtGwsvm7K1Fpv3knYqk98

###

Demo Repository