https://www.loom.com/share/2f2a8bf2b9114eeaa8e9b55912d86f8c?sid=fff7e9cc-e1b9-4ad4-8a3d-8759099ea033
- Docker
To run this project, make sure you have Docker installed and the Docker daemon is running in the background.
Execute the following command to build the Docker container and start the server:
docker system prune -f && docker build -t my-node-app . && docker-compose up
After the server is up and running, follow these steps to initialize the database:
Hit the following endpoint to initialize PostgreSQL database tables:
curl -X GET http://localhost:13000/setup-tables
To populate the newly created database tables with data from the-tate-collection.csv, use:
curl -X GET http://localhost:13000/initialize-database
Once the database is set up, feel free to explore the various endpoints provided by the server.
Each endpoint is contained within the server.js
file, and examples of hitting each endpoint can be found within the test/test.rest
file.
Initialize PostgreSQL database tables for art entries.
GET http://localhost:13000/setup-tables
Populate the art database with data from the-tate-collection.csv.
GET http://localhost:13000/initialize-database
Retrieve all art entries from the database. Because of the size of data, this is a paginated endpoint, and will return 10 entires at a time.
GET http://localhost:13000/api/art
Retrieve details for an existing art entry by providing the art ID.
- Returns 200 with Art entry if found
- Returns 404 if no entry exists
GET http://localhost:13000/api/art/20400
Creates a new user given a valid name, age and location
POST http://localhost:13000/api/users
Content-Type: application/json
{
"name": "Samuel Butler",
"age": 29,
"location": "San Francisco"
}
Create a new comment for a specific art entry with a valid user ID, name, and content.
POST http://localhost:13000/api/art/20400/comments
Content-Type: application/json
{
"userID": 123,
"name": "John Doe",
"content": "This is a great piece of art!"
}