This is a basic ResfultAPi built with Node, Express and PostgreSQL.
- Clone the repo
- Install dependencies:
npm install
- Start your Postgres server and create a database called "jobbatical"
- Create the database tables using data.sql and dum some data on
- Go to folder " /models/database" change
- var conString = "postgres://username:password@localhost/database"; with your credentials
- Start the server:
$ node start
- Go to -> http://localhost:3000/ to found the first solution for Task 1(responsive design).
- navigatave to http://localhost:3000/topActiveUsers?page=`number` && http://localhost:3000/users?id=`number` to test res JSOn APi.
tests/load-test.sh
This comes with a load test using Apache Bench that by default exercises the API endpoint for the /topActiveUsers?page=1
OR users?id=1
service:
sh tests/load-test.sh
Using this load test it is possible to verify several things:
- that the database is using as many connections as expected (it polls PostgreSQL for the number of active connections while it runs)
- the performance of the combined system under different loads
tests/test.js
This comes with unit test using mocha and should
by default exercises the API endpoint for the /topActiveUsers?page=1
OR users?id=1
service:
mocha tests/test.js