Code Monkey home page Code Monkey logo

notes's Introduction

Simple CRUD REST implementation

The purpose of this project is to explore different implementations of a REST server providing CRUD operations on "notes".

The notes have the following attributes:

  • id: auto-increment primary key.
  • text: a string.
  • created_at: datetime automatically set when a note is created.
  • updated_at: datetime automatically set when a note is updated.

The data is stored in an SQLite database.

The server provides the following REST routes:

  • Create a note: POST /notes/
  • List notes: GET /notes/
  • Get a note: GET /notes/<note id>/
  • Update a note: PUT /notes/<note id>/
  • Delete a note: DELETE /notes/<note id>/

Implementations

Currently implementations are included for:

  • FastAPI
  • Flask
  • Django REST Framework
  • Vanilla (only python standard library, no external dependencies)

The goal is to be able to compare the different frameworks and learn about their trade-offs.

Running

In each of the implementations, the server can be run as follows:

Change directory into the implementation folder. For example, for fastapi:

cd fastapi

Run the server with ./scripts/run.sh.

Then, you can use the server:

Create a note:

curl -X POST -H "content-type: application/json"  localhost:8000/notes/ -d '{"text": "some note text"} '

List all notes:

curl localhost:8000/notes/

Read a note with id 1:

curl localhost:8000/notes/1/

Modify the note with id 1:

curl -X PUT -H "content-type: application/json"  localhost:8000/notes/1/ -d '{"text": "some note text"} '

Delete the note with id 1:

curl -X DELETE localhost:8000/notes/1/

Api documentation

The api documentation is available for all implementations:

Limitations

  • No user account management is implemented. Any client can modify and read all the notes.
  • The project isn't currently Dockerized.
  • No work has been done for deploying the servers in a production environment.
  • The project structures may not be scalable. The goal of this project is to discover and compare some REST frameworks at an introductory level, not necessarily to demonstrate an architecture of a complex application.

notes's People

Contributors

caarmen avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

bod

notes's Issues

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.