Giter VIP home page Giter VIP logo

express-firestore-rest-ts's Introduction

Bookstore API

This is a CRUD API for managing books using Express.js, TypeScript, and Firebase Firestore.

Getting Started

  1. clone this repository

    git clone [email protected]:SohelKabir/express-firestore-rest-ts.git
    
  2. Install the dependencies:

    cd express-firestore-rest-ts 
    npm install
    
  3. Set up your Firebase project:

    Create a new Firebase project at https://console.firebase.google.com/ In the Firebase console, go to Project Settings > Service Accounts and click "Generate new private key" to download a JSON key file for your Firebase project. Rename the JSON key file to serviceAccountKey.json and save it in the root of the project directory.

  4. Set up the environment variables:

    Create a .env file in the root of the project directory and add the following environment variables:

    PORT=3000
    NODE_ENV=dev
    
  5. Start the server:

    npm start 
    

API Endpoints

GET /books

Retrieves a list of all books.

GET /books/:id

Retrieves a single book by ID.

POST /books

Creates a new book.

example request json body:

{
    "title":"Dune",
    "author":"Frank Herbert,",
    "year": 1965
}

PUT /books/:id

Updates an existing book by ID.

example request json body:

{
    "title":"I Am Legend",
    "author":"Richard Matheson",
    "year": 1954
}

DELETE /books/:id

Deletes a book by ID.

Demo App deployed in Render

https://express-firebase.onrender.com

to test the endpoint make a request

GET /books

https://express-firebase.onrender.com/books

Retrieves a list of all books.

express-firestore-rest-ts's People

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.