Git Product home page Git Product logo

db-api's Introduction

Databases and API

This repository contains a web application developed as part of the "Databases and API" course at Oulu University of Applied Sciences. The application is built using Node.js with Express.js framework and MySQL database, providing web interfaces to manage books and student records.

Technologies Used

  • Node.js
  • Express.js
  • MySQL
  • dotenv for environment variables management
  • Additional middleware such as cookie-parser, debug, and morgan for logging and debugging

Project Structure

  • app.js - Initializes the app and sets up middleware and routes.
  • database.js - Database
  • index.js - Index
  • /models - Contains models for database operations.
    • book_model.js - Handles CRUD operations for books.
    • student_model.js - Handles CRUD operations for students.
  • /bin - Express.js dir
    • www - Express.js web-server settings.
  • /routes - Defines the router for handling requests.
    • index.js - Root router.
    • book.js - Router for book-related operations.
    • student.js - Router for student-related operations.

Setup

To get this project up and running, follow these steps:

  1. Clone the repository:
    git clone https://github.com/vem882/DB-API.git
    
  2. Install dependencies:
    npm install
    
  3. Configure your MySQL database settings in an .env file based on the .env.example provided in the repository.
  4. Start the application:
    npm start
    

API Usage

The application exposes several endpoints for interacting with the database:

Books

  • GET /book - Retrieves all books.
  • GET /book/:id - Retrieves a book by its ID.
  • POST /book - Adds a new book. Requires name, author, and isbn.
  • DELETE /book/:id - Deletes a book by its ID.
  • PUT /book/:id - Updates an existing book. Requires name, author, and isbn.

Students

  • GET /student - Retrieves all students.
  • GET /student/:id - Retrieves a student by ID.
  • POST /student - Adds a new student. Requires data specific to your project needs.
  • DELETE /student/:id - Deletes a student by ID.
  • PUT /student/:id - Updates an existing student. Requires data specific to your project needs.

db-api's People

Contributors

vem882 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.