-
Notifications
You must be signed in to change notification settings - Fork 1
Installation & Setup
Vaishakh GK edited this page May 2, 2023
·
6 revisions
- Install Go programming language from here
- Install Mongo DB from here
- Install Mongo DB tools from here
- Create a file named
database.json - Add this data into
database.json
{
"_id": { "$oid": "642d286eb09a9ad84315fdf4" },
"username": "admin",
"password": "$2a$14$vOFw5FYpRLxu0y28foh1Mu9QNW7LObdMrI9qTtlsyuHxrmdcVIRae"
}- Import data into database
mongoimport -d "school-erp" -c "admin" --type "json" --file "database.json"- Open mongosh to execute commands.
- Run these commands in mongosh one by one.
use school-erp
db.students.createIndex({"name":"text","admissionNo":1,"applicationNo":1})-
Clone this repository and change directory
git clone https://github.com/FulgurCode/school-erp-api cd school-erp-api -
Create
.envfiletouch .env
-
Store thease values in
.env-
PORTPort that server listen for requests -
SECRET_KEYSecret key for cookie -
MONGODB_URIUri of mongodb database
Example
PORT=9000 SECRET_KEY=secret_key MONGODB_URI=mongodb://localhost:27017
-
-
Install go dependencies
go mod tidy
You can run the server by creating executable file and running or without it. For both following actions should be done in the project folder.
go build .This will create executable file for your Operating System. Now run the executable file for starting the server
You may have to give executable permission to the file
go run .Now the server is running in terminal.