montagejs / minit

Tool: Helps you build Montage applications by generating template applications and components for you.
Other
8 stars 22 forks source link

add service template #91

Open hthetiot opened 6 years ago

hthetiot commented 6 years ago

Todo

Overview

index.js (express.js or joey.js)

Init transport and setup middleware

middleware.js

Interface transport and main-service query dispatch

logic/service/name-service.js

Resolve query and return raw data for response

Quick Testing

minit-service.sh

export MY_SERVICE=email
rm -fr minit-service
rm -fr $MY_SERVICE
git clone -b features/serviceTemplate git@github.com:montagejs/minit.git minit-service
cd minit-service
npm i
cd ..
minit-service/minit create:service --name $MY_SERVICE
cd $MY_SERVICE
npm run test
npm run integration&
npm run doc&

Testing

git clone -b features/serviceTemplate git@github.com:montagejs/minit.git
cd minit-service
npm i
cd ..
minit-service/minit create:service --name Message
cd message
npm i
npm run start 
# Open console to see CRUD basic spec (will come CRUD basic ui later )

# Separate terminals
npm run test
npm run integration
npm run doc

Client

Server

Preview

screen shot 2018-04-03 at 4 58 44 pm screen shot 2018-04-03 at 4 59 25 pm screen shot 2018-04-03 at 4 59 55 pm screen shot 2018-04-03 at 5 00 15 pm
hthetiot commented 6 years ago

Know issue with missing id|subject|text property from server. Will try to fix main.mjson using montage twitter previous technic, i wanted to finish other scaffolding first.

See:

Expected server result

{
  "kafka": {
    "prototype": "logic/model/kafka-model[Kafka]",
    "values": {
      "id": 42,
      "subject": "You've got mail",
      "text": "Hello World!",
      "identifier": null
    }
  },
  "root": {
    "value": [
      {"@": "kafka"}
    ]
  }
}
tejaede commented 6 years ago

Per conversation with @hthetiot create:service should work like create:component when called from inside an application, meaning the logic should be something like the following

Consider the following command minit create:service -n foo-service

harold commented 6 years ago

This looks interesting, but I think you were hoping to mention a different Harold.

marchant commented 6 years ago

I thought we had talked about creating a root "server" folder in the project, where all assets that are server side only would live