Skip to content

moficodes/bookdata-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bookdata-api

This is a demo application showing how to build rest api using golang.

Run Locally

To run, from the root of the repo

go run .

Access the app

The App has a few Endpoints

All api endpoints are prefixed with /api/v1

To reach any endpoint use baseurl:8080/api/v1/{endpoint}

Get Books by Author
"/books/authors/{author}" 
Optional query parameter for ratingAbove ratingBelow limit and skip

Get Books by BookName
"/books/book-name/{bookName}"
Optional query parameter for ratingAbove ratingBelow limit and skip


Get Book by ISBN
"/book/isbn/{isbn}"

Delete Book by ISBN
"/book/isbn/{isbn}"

Create New Book
"/book"

Deploy app to cloud

This step is completely optional. But if you want to run you go app in the cloud somewhere IBM Cloud has an excellent paas solution using Cloud Foundry.

If you want to follow along

Once you have an IBM Cloud account and the IBM Cloud CLI installed,

From terminal

ibmcloud login
ibmcloud target --cf

Open the manifest.yaml in the root of the cloned repository.

Change the app name to something you like. After the change the file should look something like this

---
applications:
- name: <your-app-name>
  random-route: true
  memory: 256M
  env:
    GOVERSION: go1.12
    GOPACKAGENAME: bookdata-api
  buildpack: https://github.com/cloudfoundry/go-buildpack.git

Then from the root of the repo run

ibmcloud cf push

Wait a few minutes and voila! It should be running.

To find your app url

ibmcloud cf apps

You should see your app as running and also have the URL there.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages