Skip to content

Latest commit

 

History

History

backend

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Photolabs API

Setup

Install dependencies with npm install.

Creating The DB

Use the psql -U labber command to login to the PostgreSQL server with the username labber and the password labber.

Create a database with the command CREATE DATABASE photolabs_development;.

Copy the .env.example file to .env.development and fill in the necessary PostgreSQL configuration. The node-postgres library uses these environment variables by default.

PGHOST=localhost
PGUSER=labber
PGDATABASE=photolabs_development
PGPASSWORD=labber
PGPORT=5432

Seeding

Run the development server with npm start.

Both of these achieve the same result.

Run The Server

Running the server normally

npm start

Running the server so it returns an error when saving/deleting for testing the client's error handling capabilities

npm run error

Endpoints

Retrieve all photos

/api/photos

Retrieve all topics

/api/topics

Retrieve photos for a specific topic

/api/topics/:id/photos

Reset the database

/api/debug/reset