Web Application based on Vue.js and Golang
- follow below Database setup instructions to set database config and insert data
- direct to Backend folder and follow below Backend setup instructions to run the server
- direct to Frontend folder and follow below Frontend setup instructions to run front end web application
- create a folder called "config" under Backend folder to put database connection credentials
- generate a file called "mongodb.config" under config folder
- generate a file called "postgresql.config" under config folder
- create a folder called "data" under Backend folder and put data csv files in it
- set a MongoDB database in Atlas (https://www.mongodb.com/atlas) or host a local database through MongoDB Compass
- get the link credential of your databse from Atlas dashboard and copy it in mongodb.config file
- direct to Backend/src folder in command line and follow below instructions to insert data into MongoDB
call python file in command line by "python DataManager.py start #arg1 #arg2"
#arg1: Database - "Mongo" or "Postgres"
#arg2: collection or table name (the letters at the end of data file names such as "Orders" for file "Test task - Mongo - Orders.csv")
command example: python DataManager.py start Mongo Orders
- host a PostgresSQL database through pgAdmin (https://www.pgadmin.org/)
- direct to Backend/postgreSQL folder and copy scripts in DatabaseGenerator.sql file to paAdmin script board to generate tables
- put following data into postgresql.config fileuser=yourUserName password=yourPassword dbname=yourDatabaseName sslmode=disable
- direct to Backend/src folder in command line and follow below instructions to insert data into PostgreSQL
call golang file in command line by "go run DataManager.go #arg1 #arg2"
#arg1: Database - "Mongo" or "Postgres"
#arg2: collection or table name (the letters at the end of data file names such as "orders" for file "Test task - Postgres - orders.csv")
command example: go run DataManager.py Postgres orders
because of foreign key, sql data must insert in following order "1. orders, 2. order_items, 3. deliveries"
run below code in command line at Backend folder
go run server.go
run below code in command line at Fackend folder
for first time running this project on your computer
npm install
npm run serve
-
I use a function to auto-insert data from different files, so it is hard to configue which data are numbers and which are stings, this causes data inserted into MongoDB are all strings, I am still trying to find a way to convert data to proper type without checking the each data file and write different code to convert data type for them
-
PostgresSQL data insert code (Line 74 to 104 in Backend/src/DataManager.go) should be improved to make it more efficiency
-
SQL query string (Line 102 to 132 in Backend/server.go) could be put in a separate file and read in when needed
-
Retrive data method in Backend/server.go could put in a seperate dababase manager file for a better quality of code management
-
A loading data message can be add to the page when data is loading
-
Orders per page auto reset to 5 every time using filter to retrive new data, it should be keep what user choose if user does not reload the App