#RESTFUL API: All API links are provided in routes folder: please not the link within secure file the structure will be : localhost:4000/secure/name_provided_in_file api file the structure will be :localhost:4000/api/name_provided_in_file
For all POST/PUT request links are restricted to accept specific data structure. The detail input schema please see helper/routeHelper.js
some examples:
- Post localhost:4000/secure/register
- Post localhost:4000/secure/signin
- Get/Post localhost:4000/api/admin
- Put/DELET localhost:4000/api/admin/:admin_id
- get/post localhost:4000/api/campus
- put/delete localhost:4000/api/campus/:campus_id
- get/post localhost:4000/api/building
- put/delete localhost:4000/api/building/:building_id
- get localhost:4000/api/building/campus/:campus_id
- get/post localhost:4000/api/room/
- put/delete localhost:4000/api/room/:building_id
Before you run the project on local, you first need to :
- have node, mongodb, yarn installed on local
- populate your mongodb with following step (you could mongodb community or cmd )
- create a database call "CSS"
- create collections according the files in "sample data" folder
- import the json file accordingly
- once your mongodb is created, you could start next phrase
-
From the project's home directory, run command:
npm install
for the first time running the backendnode server
ornodemon server
to execute the backend -
Then, go to the Create-React-App directory,
cd client_react
, and run command:yarn
for the first time running the frontendyarn start
to execute frontend -
If you finish the development and want to host the project on your website, you should create an optimized production build for the react app. So, in directory
/client
, run command:yarn build
For development, you need to run both Express server on http://localhost:4000
and React App on http://localhost:3000
.
-
Run the following command in both the root project folder (/) and the React App folder (/client):
node server
oryarn start
-
The project will automatically open in your default browser. Google Chrome is recommended. The website will open on port 3000 of localhost.
-
Whenever you make changes on the Express server, you need to restart the Express server.
-
For React App, you can make changes and they will automatically reflect in the browser.
When you finish your project and want to go live on your own website hosting service, build the React App first then run the following command in the root project folder:
npm start
or yarn start
If you are testing the project on Localhost, the project will start on port 4000. So, in your browser, open:
http://localhost:4000