Giter Club home page Giter Club logo

note-taking's Introduction

Note Taking API

A basic note-taking API which Supports CRUD operations via a RESTful API for manipulating note objects. Available in Python/Flask (server.py) and Node/Express (server.js). Use whichever you feel most comfortable with.

Python Installation

Run all instructions from within the note-taking repository root folder.

Runs on Python 3.4+, installation guide found here.

You should already have pip installed if you're running Python 3.4+, so the only dependencies required are Flask and Flask CORS:

sudo python3 -m pip install flask flask_cors

Running

Once you have all dependencies installed, the server can be run with:

FLASK_APP=server.py FLASK_ENV=development flask run

This will bind the web server to port 5000 locally.

Node Installation

As a prerequisite make sure you have node (min v6.x) installed. From this directory run npm install to install dependencies.

Then to run the server: npm start.

Troubleshooting

socket.error: [Errno 48] Address already in use Ensure you do not have any other application running on port 5000, then try starting the server again

REST API

A note object looks like the following:

  {
    "id": 1,
    "title": "Test Note",
    "body": "This is a test note object that will be available by default",
    "created_at": 1536601583871,
    "created_by": "admin",
    "edit_history": [
      {
        "edited_at": 1536601593871,
        "edited_by": "A User"
      }
    ],
  }

LIST

GET /notes Returns all notes

Returns: array of note objects

GET

GET /notes/:id Returns a single note given its numeric id

Args:

id:int

Returns: note object

CREATE

POST /notes Adds a new note, assigning it a new auto-incremented id and created_at field with the current timestamp. A new note also has an empty edit_history list. The new note is returned.

Args:

note:dict
    created_by:string
    title:string
    body:string

Returns:

note object

UPDATE

POST /notes/:id For a given note id and dict of changes, updates the note with the changes and updates the edit history to contain the user who made the change and the current time (if edited_by is provided).

Args:

id:int
body:json object
    edited_by:string
    title:string
    body:string

Returns:

note object

DELETE

DELETE /notes/:id Removes the note for the given id and returns True if removed, False if the note was not removed or it did not exist in the first place.

Args:

id:int

Returns:

boolean

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.