Skip to content

This is an Express app with an API. I have started learning express as well.

Notifications You must be signed in to change notification settings

uroobaCodes/express-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Book Store API

This project is a simple Book Store API built using Node.js with Express for the backend and Vanilla JavaScript for the frontend. It allows users to view and add books to the store via a RESTful API.

Features

  • GET /api/books: Fetch all books.
  • POST /api/books: Add a new book to the store.

Getting Started

Prerequisites

Make sure you have the following installed:

  • Node.js
  • npm (comes with Node.js)

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/bookstoreapi.git
    cd bookstoreapi

Install Dependencies

npm install

Running the App

  1. Start the server:
npm run dev

This will start the Express server and you can access the API at http://localhost:3000.

Frontend

The frontend part of the application is in index.html and the script.mjs file. It allows you to add books and view the list of books by interacting with the backend API.

API Endpoints

GET /api/books: Returns a list of books.

POST /api/books: Allows you to add a new book (requires title and author in the body).

Development

For local development, the app uses nodemon to auto-reload the server on changes:

npm run dev

About

This is an Express app with an API. I have started learning express as well.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published