From 2ab67779622b6f6499de772685497924558e2d76 Mon Sep 17 00:00:00 2001 From: yasiru Date: Sat, 5 Dec 2020 23:32:11 +0530 Subject: [PATCH 1/2] setup json server --- data/db.json | 34 ++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 data/db.json diff --git a/data/db.json b/data/db.json new file mode 100644 index 0000000..1663ea5 --- /dev/null +++ b/data/db.json @@ -0,0 +1,34 @@ +{ + "employees": [ + { + "userId": 1, + "jobTitleName": "Developer", + "firstName": "Jhon", + "lastName": "Doe", + "employeeCode": "E1", + "department": "SE", + "phoneNumber": "408-1234567", + "emailAddress": "jhond@gmail.com" + }, + { + "userId": 2, + "jobTitleName": "Tester", + "firstName": "Alan", + "lastName": "Irani", + "employeeCode": "E1", + "department": "QA", + "phoneNumber": "408-1234567", + "emailAddress": "Alan@gmail.com" + }, + { + "userId": 3, + "jobTitleName": "Developer", + "firstName": "Steve", + "lastName": "Smith", + "employeeCode": "E1", + "department": "SE", + "phoneNumber": "408-1234567", + "emailAddress": "st.smith@gmail.com" + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index ddb4b8c..c162603 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "scripts": { "start": "react-scripts start", + "json-server": "json-server --watch data/db.json --port 3001", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" @@ -34,4 +35,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file From 77cd7959079605f2af7e512a5b7c45f56ae86b24 Mon Sep 17 00:00:00 2001 From: yasiru Date: Sun, 6 Dec 2020 01:01:56 +0530 Subject: [PATCH 2/2] documentation update - JSON server --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ee19b53..3efe3a5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# OpenIntra 🚀🏗 +# OpenIntra 🚀🏗 -The OpenIntra is an Open Source Intranet System tailored for enterprises. +The OpenIntra is an Open Source Intranet System tailored for enterprises. This frontend is powered by React⚡ and it was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). @@ -31,12 +31,15 @@ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. -### `npm run eject` +### `npm run json-server` (new) -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** +Run JSON server as prototype backend. Since our backend under development please use JSON-server as the prototyping backend. following are the steps you g through to spin up the JSON server. -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. +- install JSON server globally by using the following command. + `$ npm install -g json-server` -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. +- CD into project directory. + `$ cd open-intra` -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. \ No newline at end of file +- run following command. + `$ npm run json-server`