Origin API is the Express/NodeJS server responsible for handling API requests for Origin (https://github.com/yulia-kh/origin). While running, users can make the following API requests:
-
POST /api/usersCreate a user account. Required fields:- first name
- last name
- user name
- password (must contain at least one special character, digit, capital and lowercase letter, 8 -72 character long)
-
POST /api/auth/loginGet access to your account. Reqired fields:- username
- password
-
GET /api/treeHome page. Display user's family tree -
POST /api/persons/:id/parentsAdd an ancestor. Inserts record inpersonstable and relation to child inparent_childtable -
DELETE /api/persons/:id/Delete an ancestor. Deletes record and relation to child from database -
GET /api/persons/:id/Get information about a person -
PATCH /api/persons/:id/Edit information about a person
- Clone the repository and run
npm i - Create local Postgresql databases:
familyandfamily-test - Run
mv example.env .envand provide the local database locations within your.envfile - Run
npm run migrate and npm run migrate:testto update each database with appropriate tables - To seed, use terminal to enter root of application and run
psql -d family -f ./seeds/seed.family-tables.sql - Run npm run dev to start server in development mode
- NodeJS
- Express
- Postgresql