This repository shows a comparison of 3 different ways to get data from the server.
- sockets
- using socket.io to query the database directly
- sockets / api
- using socket.io and then requesting the data through an axios get request
- api
- requesting the data through an AJAX get request
- HTML5
- CSS3
- Socket.IO
- JQuery
- Express
- Node.js
- axios
- PostgreSQL
- Socket.IO
- create postgresql database named 'speedtest'
- modify .env file to reflect your database information
DB_HOST=localhost
DB_USER=yourusername
DB_PASS=yourpassword
DB_NAME=speedtest
DB_PORT=5432
- run
npm install
to get the required packages. - run
npm run db:reset
to create the table (users) for the database, and create the seeded data - run
npm start
to start up the server.
home page - tests and results
clicking on each test button will run one instance of the API request (click as many times as you want results for each test scenario)
clicking on the result button shows the list of the results in the browser's console
data - shows the 3 test scenarios
20 iterations were taken for each of the 3 types of scenarios
test 1 results: socket -> db
test 2 results: socket -> api -> db
test 3 results: api -> db