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

export and import feature #49

Open
amovah opened this issue May 30, 2019 · 7 comments
Open

export and import feature #49

amovah opened this issue May 30, 2019 · 7 comments
Labels
1.2 enhancement New feature or request

Comments

@amovah
Copy link

amovah commented May 30, 2019

first of all, mockit is great work.

it can be very good if you there is a feature that I can easily export and import my routes. for backing up stuff or sending to another one.

imagine that, I'm backend guy. and my front end guys wants to integrate with API. but API is under development, so I can mock my API and export my setting and routes and send it to my front developer. and then front developer than simply import my exported data, and use API and integrate with that.

I'm interested in to bring this feature.

@boyney123
Copy link
Owner

Hey @amovah ,

Thanks for the feedback!

Yeah that sounds like quite an interesting feature, we have had requests for OpenAPI: #5 which might solve the problem too?

In your example would your back end dev be writing with express? Or...

In theory, you could have something that maps express routes / apps into the configuration.json that mockit requires and things should just work.

My initial thoughts are it will be alot of effort

@amovah
Copy link
Author

amovah commented May 30, 2019

@boyney123 we should consider this feature generally. for this project my server side is based on express. but maybe later, it can be python ruby java. so we should consider a better solution than mapping from express.

we dont need to map express routes to mockit app. I think only thing that we need, is exporting routes that we defined in mockit app and then import in another mockit in another machine.

where is mockit storing data? if I add a route into app, where is data going to be stored? in json file or a database or something like that ? if it's in file or database we can simply export that file or make a backup from database, then send it to user. so user can send that file (generated from backing up database or it's simply json file) to another user, and then that another user can simply import that file.

Or we can, bring a feature that will saves all routes into json file. then we can use that json to import routes into new app.

[{route: '/test', method: 'post', ..... }]

something like that, and another app will read data from this array and add routes that is inside of array.

@boyney123
Copy link
Owner

Hey @amovah , thanks for confirming some stuff.

Yeah this sounds great! We currently have a routes.json file that holds all the information, so all we would need to do it maybe add some buttons to export or import (maybe in the settings modal?) some JSON configuration.

Export would save to a file on the machine

Import could just take the JSON import for now, and override the configuration file.

Sounds great!

Did you want to try and pick this up? I dont mind doing it / helping out

@boyney123 boyney123 added 1.2 enhancement New feature or request labels May 31, 2019
@amovah
Copy link
Author

amovah commented May 31, 2019

yes, I will be glad to help this out.

I try to bring this feature.

@amovah
Copy link
Author

amovah commented May 31, 2019

what is difference between these configurations file?

1: configuration/routes.json
2: client/config/routes.json
3: mockit-routes/configuration/routes.json
4: server/configuration/routes.json

they are same or not ? what is their job?

@boyney123
Copy link
Owner

I should add some docs to this.

The way the whole thing works is they each can run in isolation. Meaning in the project you can run the client, mockit-routes and server as seperate apps.

The config itself is the same across all the apps.

When docker comes in it mounts the root configuration/routes.json into each app. Meaning all apps that touch it will read from it, from the same file on disk.

To get yourself up and running I would.

npm start in the client directory and this will read the configuration file in that project. If you want to export read that in from the directory and give it to the users. If you want to import you might need to add a route into the server (express) place.

If you create a new route to upload files, and have that uploaded file replace the configiration file in the server folder than things would be OK.

To test everything run docker-compose which will mount the 1 config file to all projects ready for consumption. I hope that makes sense?

I will write up some more contributing docs to help

@amovah
Copy link
Author

amovah commented Jun 1, 2019

why we can't use only one configuration file ? you confirm that, when docker comes they become one, so under development enviroment, I couldn't run this app untill I edited all of them and make them same. another thing is why we dont use one configuration file if all them are same as each other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.2 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants