Giter Club home page Giter Club logo

bookmark-api's Introduction

Bookmark API

Build Status

This is simple bookmark api that you could handle your bookmarks easily

Getting Started

Please follow the instructions to install Go on your computer.

After installing Go, run the following commands to start:

git clone https://github.com/firstthumb/bookmark-api.git

cd bookmark-api

make run

At this time, you have a RESTful API server running at http://127.0.0.1:8080. It provides the following endpoints:

  • GET /signin/google: google auth, creates JWT Token
  • POST /bookmarks: creates new bookmark
  • GET /bookmarks/:id: returns the detailed information of an bookmark
  • POST /bookmarks/:id/tags/:tag: adds tag to the bookmark
  • DELETE /bookmarks/:id/tags/:tag: deletes tag to the bookmark

DEMO

Create AccessToken with api.booklog.link/singin/google

curl -X GET https://api.booklog.link/api/v1/bookmarks/{BOOKMARK_ID} -H 'Authorization: Bearer {TOKEN}'

curl -X POST https://api.booklog.link/api/v1/bookmarks -H 'Authorization: Bearer {TOKEN}' \
    -d '{
        "name": "Google",
        "url": "https://www.google.com",
        "tags": ["google", "search", "engine"]
    }'

curl -X GET https://api.booklog.link/api/v1/bookmarks?query=Google -H 'Authorization: Bearer {TOKEN}'

curl -X POST https://api.booklog.link/api/v1/bookmarks/{BOOKMARK_ID}/tags/{TAG} -H 'Authorization: Bearer {TOKEN}'

curl -X DELETE https://api.booklog.link/api/v1/bookmarks/{BOOKMARK_ID}/tags/{TAG} -H 'Authorization: Bearer {TOKEN}'

DynamoDB Structure

ID RANGE Action
USERNAME-{USERNAME} NAME-{NAME}-{ID} SearchByName
USERNAME-{USERNAME} TAG-{TAG}-{ID} SearchByTag
USERNAME-{USERNAME} CREATED-{CREATED}-{ID} PartitionByCreatedAt
USERNAME-{USERNAME} BOOKMARK-{ID} Bookmark Data

I am planning to use Lambda Store for caching.

Project Layout

.
├── cmd                  main applications of the project
│   └── bookmark         the API server application
├── config               configuration files for different environments
├── function             lambda functions
│   ├── lambda           lambda main function for HTTP
│   └─- worker           lambda main function for SQS
│   └─- authorizer       lambda authorizer
├── internal             private application
│   ├── auth             auth features
│   ├── bookmark         bookmark features
│   ├── di               wire configuration
│   ├── entity           entity definitions
│   ├── errors           error types
│   ├── session          session operations
│   └── user             user features
├── pkg                  public library code
│   ├── db               database implementation
│   ├── logger           logger
│   └── utils            utilities

bookmark-api's People

Contributors

firstthumb avatar

Stargazers

 avatar

Watchers

 avatar  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.