I built a REST API with Redis
Abhishek Keshri

Abhishek Keshri @2kabhishek

About: Learner 📚 | Maker 💻 | Explorer 🔎

Location:
India
Joined:
Oct 23, 2019

I built a REST API with Redis

Publish Date: Aug 29 '22
22 9

What is this

A REST API built with Node to demonstrate Redis persistence.

Inspiration

Was learning about redis persistence, wanted to try it out.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed the latest version of node and redis

Getting redi-to-rest

To get redi-to-rest, follow these steps:



git clone https://github.com/2kabhishek/redi-to-rest
cd redi-to-rest


Enter fullscreen mode Exit fullscreen mode

Using redi-to-rest



cp .env.example .env
$EDITOR .env #Set the REDIS_URL env to your redis instance
npm start


Enter fullscreen mode Exit fullscreen mode

How it was built

redi-to-rest was built using neovim

What I learned

  • Learned about redis ecosystem.

Submission Category:

Minimalism Magicians

Language Used

Node.js

Link to Code

GitHub logo 2KAbhishek / redi-to-rest

REST API with Redis 📭🍎


License


People


Stars


Forks


Watches


Last Updated

REST API with Redis 📭🍎

What is this

A REST API built with Node to demonstrate Redis persistence.

Inspiration

Was learning about redis persistence, wanted to try it out.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed the latest version of node and redis

Getting redi-to-rest

To get redi-to-rest, follow these steps:

git clone https://github.com/2kabhishek/redi-to-rest
cd redi-to-rest
Enter fullscreen mode Exit fullscreen mode

Using redi-to-rest

cp .env.example .env
$EDITOR .env #Set the REDIS_URL env to your redis instance
npm start
Enter fullscreen mode Exit fullscreen mode

How it was built

redi-to-rest was built using neovim, node, redis

How the data is stored:

Refer to this example for a more detailed example of what you need for this section.

How the data is accessed:

Refer to this example for a more detailed example of what you need for this section.

Performance Benchmarks

[If you migrated an existing app to use Redis, please put performance benchmarks…





Comments 9 total

  • Wj
    WjAug 30, 2022

    :applause:

  • Tobias Nickel
    Tobias NickelAug 31, 2022

    a while back i also implemented a small orm, i had a version for each mysql, mongodb and redis. Each having the same api. for redis was the most coding work needed, bucause the lib had to maintain the indexes.

    the cool part of my solution was, that because they have the same APIs, it was easily pissible to connect the data between different db and different kind of db.

    I will check out your implementation, maybe i can learn something from it.

    • Abhishek Keshri
      Abhishek KeshriAug 31, 2022

      That would be great, mine's just a simple and quick express app with a note schema defined that can read and write to redis

      • Tobias Nickel
        Tobias NickelAug 31, 2022

        yes, i see an api to record notes. I am also currently working on a personal notes taking app. but it is using sqlite. and it is more a playground project to try lots of ideas.

    • Abhishek Keshri
      Abhishek KeshriAug 31, 2022

      Can you share the link to your implementation, sounds interesting

      • Tobias Nickel
        Tobias NickelAug 31, 2022

        github.com/TobiasNickel/TKeyValueDao

        I found that I actually did not build it with redis, but with a simple in memory keyValue store. still, the store might be compatible with redis.

        it uses superstruct schemas. in test.js you can how it is used.

        • Tobias Nickel
          Tobias NickelAug 31, 2022

          if you are interested in merging/joining data across db, the readme of the mysql version is very much complete: mysqlpromisedao.

          it is a lib that provides a repository for db tables. It generates lots of functions based on a given schema.
          cool features are:

          • joins and cross db joins
          • query batching(reduce the number of requests to the db. what is perfect for graphql)

          but, it does not has any typescript support. I have build this, I build the mongodb version, I build the keyvalue version, but never used them in production,.... and before i do, I would add typescript.

          • Abhishek Keshri
            Abhishek KeshriAug 31, 2022

            this looks quite interesting, I'll have a look!

Add comment