Simple REST API for birthday party management.
JavaScript
Express
PostgreSQL
- install
node
- install
postgresql
git clone https://github.com/wojciechszmelczerczyk/express-manage-birthday-app
cd /express-manage-birthday-app
npm i
npm run dev
Create .env
file and setup variables.
# server port number
PORT=
# db user
DB_USER=
# db password
DB_PASSWORD=
# db name
DB_NAME=
# db host
DB_HOST=
# db port
DB_PORT=
# jwt expiration time in milliseconds
JWT_EXPIRATION_TIME=
# jwt secret string
JWT_SECRET=
# date yyyy:mm:dd hh:mm:ss format
BIRTHDAY_DATE=yyyy:mm:dd hh:mm:ss
# string data
BIRTHDAY_PLACE=
# name for invitation file
FILE_NAME=invitation.txt
Login to postgresql as superuser.
In order to setup database run following script:
CREATE DATABASE birthday_party
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
CREATE TABLE guest (
guest_id serial PRIMARY KEY,
name VARCHAR ( 50 ) NOT NULL,
surname VARCHAR ( 50 ) NOT NULL,
uuid VARCHAR ( 50 ) NOT NULL,
"isOwner" BOOLEAN DEFAULT FALSE,
status VARCHAR ( 50 ) DEFAULT NULL,
modified_status TIMESTAMP DEFAULT NULL
);
UPDATE guest
SET "isOwner" = true
WHERE guest_id = 1;
Import file included in project.
Method | Endpoint |
---|---|
POST | /guest/register |
POST | /guest/auth |
DELETE | /guest/logout |
PUT | /guest/change-status |
GET | /guest/download-invitation |
GET | /owner/list/accepted |
GET | /owner/list/no-feedback |
GET | /owner/list/denied |