This sample project is managing gateways - master devices that control multiple peripheral devices
A simple REST service (JSON/HTTP) for storing information about gateways and their associated devices with a Basic UI to list and manage gateway devices. All information is stored in Mongo database.
- Clone this repo
git clone https://github.com/aymanaladdin/gateway-manager.git- After clonning successfully switch to cloned repo dir and install deps
cd ./gateway-namager && npm run install:all- create an
.envfile toserversub dir, you can replace values with your own specially mongo URI
PORT=5000
NODE_ENV=development
MONGO_URI=mongodb://localhost:27017/gateway-manager- create an
.envfile toclientsub dir, you can replace values with your own
REACT_APP_API_URL = http://localhost:5000/api/v1- if you have a docker installed with docker-compose you could start the mongo container in
docker-compose.yamlfile via
docker-compose up -d mongo- To init start mongo with seeded data run the following cmd, this will create a collection with seeded data
docker-compose up -d mongodb mongo-seed- if you don't have installed docker you should download a mongo client first and start it manually
- you could still able to seed data manually as well, open mongo shell from terminal and run the following cmd
mongoimport --host localhost --port 27017 --db gateway-manager --collection gateways --mode upsert --type json --file /data/seeding/gateways.json --jsonArray- to start app in development mode run the following cmd from root dir
npm run dev- this will start
client:reactapp in development which you can access by default viahttp:localhost:3000 - also it will start
server:expressapp in development which you can access by default viahttp:localhost:5000
- Run the following command to run a bundled version of the app altogether
npm run start- this command will build
client:reactandserver:expressapps and serve them from a single app by defaulthttp:localhost:5000
- Run the following command to run a bundled version of the app altogether
npm run docker:start- this command will build both
client:reactandserver:expressapps, then start a docker container for the bundled app by defaulthttp:localhost:5000
- Make sure that you have a mongo client up and running otherwise the
server:expressapp will fail to start, you can start it manually or via docker as described inDB Starting section - Make sure that you added
.envfiles in both./serverand./clientsub dirs otherwise processes will fail while starting
- you can use
npm run dev:clientto runclient:reactapp only - you can use
npm run dev:serverto runserver:expressapp only - you can use
npm run build:clientto buildclient:reactapp and push the built files toserver:expressdocs sub dir
This project is licensed under the [MIT] License