Skip to content

MateusGesualdo/FutureBook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FutureBook

Stack

  • Express
  • MySql
  • Knex
  • Uuid
  • Bcrypt
  • JsonWebToken
  • Dotenv
  • Cors

Running the project

  1. Clone this repository into your machine

  2. Open your preferred CLI inside the cloned repo and run the following commands:

    • npm install
    • touch .env
    • start .env
  3. Paste the following environment variables into your .env file, replacing their values for those of your own SQL database:

       DB_USER = me
       DB_PASSWORD = xxxxxxxxxxxxxxxxxxxx
       DB_NAME = myschema     
       JWT_KEY = xxxxxxxxxxxx
    
  4. Run the following queries on your SQL database:

    CREATE TABLE future_book_users (
        id VARCHAR(255) PRIMARY KEY,
        name VARCHAR(255) UNIQUE NOT NULL,
        email VARCHAR(255) UNIQUE NOT NULL,
        password VARCHAR(255) UNIQUE
    );
    CREATE TABLE future_book_friends (
        user_id VARCHAR(255),
        friend_id VARCHAR(255),
        PRIMARY KEY (user_id , friend_id),
        FOREIGN KEY (user_id) REFERENCES future_book_users (id),
        FOREIGN KEY (friend_id) REFERENCES future_book_users (id)
    );
    CREATE TABLE future_book_posts (
        id VARCHAR(255) PRIMARY KEY,
        author_id VARCHAR(255),
        description VARCHAR(255),
        creation_date DATETIME,
        type VARCHAR(255),
        img VARCHAR(255),
        FOREIGN KEY (author_id) REFERENCES future_book_users (id)
    );
    CREATE TABLE future_book_likes (
        friend_id VARCHAR(255),
        post_id VARCHAR(255),
        PRIMARY KEY (friend_id , post_id),
        FOREIGN KEY (friend_id) REFERENCES future_book_users (id),
        FOREIGN KEY (post_id) REFERENCES future_book_posts (id)
    );
    CREATE TABLE future_book_comments (
        id VARCHAR(255) PRIMARY KEY,
        friend_id VARCHAR(255),
        post_id VARCHAR(255),
        comment_text VARCHAR(255),
        FOREIGN KEY (friend_id) REFERENCES future_book_users (id),
        FOREIGN KEY (post_id) REFERENCES future_book_posts (id)
    );
  5. Run npm run start on your CLI

  6. Open your browser's localhost and test the endpoints using this project's own GUI. You'll find templates for all available requests, but feel free to send them via other softwares such as Postman.

About

Back-end project inspired on FaceBook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published