Skip to content

Simple web service for connecting to Redis & testing basic CRUD actions

Notifications You must be signed in to change notification settings

dimitraz/go-redis-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go simple redis service

Simple web service for connecting to Redis and testing basic CRUD actions for Microlib. Uses a generic script script.sh to simulate start & stop for Linux & MacOS based systems.

Usage

Replace the EXEC variable in script.sh with the name of your executable, if it's different. Update the config.json with your redis host and port settings, then:

# cd to project directory and build executable
$ go build .
$ chmod u+x script.sh

# start the service
$ ./script.sh start

# stop the service
$ ./script.sh stop

To check, execute the following commands (change your host and port settings accordingly)

# Get values from redis
$ curl http://localhost:9000 

# Create value 
$ curl http://localhost:9000/create/2

# Update value and check
$ curl http://localhost:9000/update/6
$ curl http://localhost:9000 

# Delete value and check
$ curl http://localhost:9000/delete/6
$ curl http://localhost:9000 

Note

The http server uses signals to allow for graceful shutdown. Use this as a standard pattern when creating all web services.

About

Simple web service for connecting to Redis & testing basic CRUD actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published