Skip to content

RavenPl/MyLibrary-v3-BE

Repository files navigation

My library [BE] - v3



📔 Table of Contents


🌟 About the Project

  • a small variation of a todo list
  • it allows you to add your favourite books

👾 Tech Stack

Server
  • Express.js
  • TypeScript
Security
  • Helmet
  • Express Rate Limit
Database
  • MySQL

Technology used

javascript      typescript     react      nodejs       jest    express js       mysql      git    npm   


🎯 Features

  • adding a new book to the list ✔️
  • editing existing ones ✔️
  • deleting specific one or all at once ✔️
  • you can search your book by title or by author name ✔️
  • you can list your positions by title, author, page number or by status ✔️

🧰 Getting Started

🔑 Environment Variables

In order to run this app you need to create config.ts and place it in config folder. File should contain following fields with your correct data, for instance:

const config = {  
    dbHost: 'localhost',  
    dbUser: 'user',  
    dbDatabase: 'databaseName',
    dbPassword: "",
    corsOrigin: 'http://localhost:3000',  
}

❗ Prerequisites

This project uses npm as package manager

 npm install --global npm  

🏃 Run Locally

Clone the project

 git clone https://github.com/RavenPl/MyLibrary-v3-BE.git

Go to the project directory

 cd my-library-BE  

Install dependencies

 npm install  

Start the server

 npm start  

👀 Usage

  1. Add your data into config file.
  2. Create table in your database using this SQL:
CREATE TABLE IF NOT EXISTS `books` (
 `id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
 `title` varchar(5633) COLLATE utf8mb4_unicode_ci NOT NULL,
 `author` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
 `pages` int(5) NOT NULL,
 `status` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'not read',
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

🌳 Lessons Learned

☑️ putting together JavaScript, Typescript, mysql2 into one, working application

☑️ creating and running few test using Jest

☑️ adding basic security middlewares: express-rate-limit and helmet

☑️ fixing CORS problem


🛠️ Project Status

The project is closed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published