Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add service template #91

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open

add service template #91

wants to merge 69 commits into from

Conversation

hthetiot
Copy link
Contributor

@hthetiot hthetiot commented Mar 27, 2018

Todo

  • Dockerfile
  • Docker build, compose, deploy via npm
  • add sample joey|express http transport router to service
  • add sample socket.io http transport router to service
  • add sample UI with MainService and child HelloWorldService
  • dispatch serialized query (save|delete|fetch)Data to middleware.js MainService
  • add sample swagger
  • add sample test and integration
  • return main service result
  • add join|leave sample socket.io aka subscribe data
  • main.mjson entry point to configure service
  • fix nodeJS property descriptor
  • add sample CLI enpoint

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 [email protected]: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 [email protected]: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 hthetiot self-assigned this Mar 27, 2018
@tejaede
Copy link

tejaede commented Apr 26, 2018

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

  • If current working directory is not an application

    1. Create application
    2. Add middleware.js, express.js, data/main.mjson to application
    3. Add logic/service/foo-service.js, logic/model/foo.js, data/descriptors/foo.mjson, data/foo-service.mjson to application
    4. Add reference to foo-service.mjson in main.mjson (if not added in step 1)
  • If current working directory is an application, but does not have stack

    1. Add middleware.js, express.js, data/main.mjson to application
    2. Add logic/service/foo-service.js, logic/model/foo.js, data/descriptors/foo.mjson, data/foo-service.mjson to application
    3. Add reference to foo-service.mjson in main.mjson
  • If current working directory is an application and has stack

    1. Add logic/service/foo-service.js, logic/model/foo.js, data/descriptors/foo.mjson, data/foo-service.mjson to application
    2. Add reference to foo-service.mjson in main.mjson

@harold
Copy link

harold commented Apr 26, 2018

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

@marchant
Copy link
Member

marchant commented May 3, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants