####Install Go version 1.14
-
Follow the instructions on https://golang.org/doc/install#download to download and install Go
-
You can visit https://golang.org/dl/ to find and download the version
1.14
-
Verify your installation is successful by checking the go version on your machine
-
In cmd/terminal on your machine, enter:
$ go version
-
You should see the following result in cmd/terminal:
go version go1.14 darwin/amd64
-
-
Follow the instructions on https://docs.mongodb.com/manual/installation/ to download and install MongoDB.
-
Verify your installation is successful by checking the MongoDB server and MongoDB Shell version on your machine.
-
Follow the instructions on https://nodejs.org/en/download/ to download and install node.js.
-
Verify your installation is successful by checking the node version on your machine.
-
In cmd/terminal, enter:
$ node -v
-
You should see something looks like the following result
v14.16.0
-
-
Please use Go version
1.14
for building. (Tested on1.14.15
). Make sure Go is installed properly on your machine. -
In cmd go to folder
Checkinandout
. (cmd may vary in different system, current one is based on Mac)$ cd {your path}/Chechinandout
-
In cmd run
$ go build
. -
If build successfully, you’ll see an executable file named
cc-server.exe
(orcc-server
) under the project root.
-
Create an empty
data
folder under project root. Make sure all the cmd run is under the project root. -
Open file CHECKINANDOUT/configs/cc-server.json, change the
mongo_server_uri
andserver_address
to your local address. You can refer to thecc-server-dev.json
file.- Find the configuration files for backend
- Change addresses
-
click
startup.bat
and let it run (if you are using Mac, please use the alternative methods). -
A portal website will be hosted at
localhost:8000\super-admin\redirect
. Please open the url in browser to use it.
-
Please startup a mongodb server. For local mongo server, in cmd run
mongod --dbpath=/data
(you can replace the "/data" with any directory you wish; you need to create the folder before runningmongod
). If cmd reports "mongod not recognized", please install mongodb or check environment variables. -
In cmd, run
.\cc-server.exe
. (On Mac, run./cc-server
)- If you get the following result, then the backend is running well
-
A portal website will be hosted at
localhost:8000\super-admin\redirect
. Please open the url in browser to use it.
-
Make sure the backend is running properly on your machine and you are under the project root.
-
Go to
web/cc-portal/config/index.js
, use the localhost address as the API address. -
In terminal, go to the folder
web/cc-portal
$ cd web/cc-portal
-
In terminal, run
$ npm install
.- Run
npm -v
to check npm is installed properly. - You’ll get npm version information as the result.
- Run
-
Use
$ npm run serve
to run the frontend app. The app will be hosted athttp://localhost:8080/
. -
Use
$ npm run build
to build the frontend app, the buit files will be inweb/cc-portal/dist
.
- Login to
mongo
shell, and switch db byuse go_mongo
- Update the Token using the following shell command:
> db.configs.update({name: "default"}, {$set: {sms_auth_token: "65a64755b83eb1e8e6ece4a7e7b6bce7"}})
If Succeed, the shell returns info:WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
- Testing is recommended after changing/refractoring the code.
- To run tests, run following command in cmd:
go clean -testcache; go test ./tests
- (Optional) to show debug info when testing, append
-v
option togo test
(go test ./tests -v
)