Code Monkey home page Code Monkey logo

addressbookmvc's Introduction

Goal

  • Create various implementations of a minimally simple addressbook service

Why?

  • To ease comparison between different languages/frameworks/approaches
  • To demonstrate how to use the various languages/frameworks/approaches

The Original Idea

http://todomvc.com but using server-side technologies.

  • have a database with a table with names and phone numbers (and probably a surrogate key)
  • the application should list all the entries (optionally paged)
  • you should be able to add, edit and delete an entry
  • each entry has 2 fields: name and phone number
  • any other features are optional

Implementation Guidelines

General

  • Go for clarity and simplicity which should ease comparison and improve the pedagogical win.
  • Err on the side of excessive commenting.
  • Implementations MUST include persistence.
  • Implementations SHOULD behave as described in the API doc below, whether it provides an actual API service or merely outputs HTML directly.

Contacts

A contact is completely described as:

{
  "id":   <integer>,
  "name": "<string>",
  "phone": "<string>"
}

SQL

If you choose to use an SQL-based persistence, here is some example DDL:

CREATE TABLE contacts (
id INTEGER NOT NULL PRIMARY UNIQUE AUTOINCREMENT,
name TEXT NOT NULL,
phone TEXT NOT NULL
);

The above is SQLite compatible syntax.

File

If you choose to use file-based persistence, please use OS-independent path handling/access where possible.

API

URI Responses1 HTTP Method (Verb) and Parameters Description
/contacts 200, 204 GET list all contacts
/contact 201, 400 POST with JSON representation of new contact create a new contact
/contact/<id> 200, 404 GET display a specific contact
/contact/<id> 200, 400, 404 PUT with JSON representation of new data update a specific contact
/contact/<id> 204, 404 DELETE delete a specific contact

addressbookmvc's People

Contributors

aditsu avatar dhutty avatar pdurbin avatar prologic avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

addressbookmvc's Issues

Java EE example

I have some experience in Java EE and JSF so I've contributed an example. The idea with my example is to use "stock" Java EE and JSF without any addons such as Primefaces or PrettyFaces.

To do:

  • use PosgreSQL rather than Derby

Create a spec

If we create specification, it would make it easier to create examples in new languages/frameworks (and test them).

This could be done iteratively with several levels depending on the time/effort available:

  • Broad, qualitative description of what the app should do
  • Complete ReST API docs
  • Test suite(s) to test functionality (unit testing would of course, be in the domain of the developer of each example stack).

Is there already a TodoMVC for back end (server-side) technologies?

http://todomvc.com is a fantastic resource for helping developers evaluate Javascript MVC frameworks. Rather that reading people's opinions you can look at actual code and play with demo apps.

Is there already a repository of various examples of implementing the same simple demo web application in back end or server-side technologies? Creating an address book webapp was suggested, which sounds fine, so that's what this repo is about: rending HTML on the server-side.

If something like this already exists, however, please link to it in a comment.

Ozark (MVC 1.0) example

In 8c2678d I stubbed out an example using Ozark (MVC 1.0): https://ozark.java.net

I'm not done, however. The biggest problem I'm having is that I'm not sure how to populate the home page with the list contacts (people in the address book).

I'm able to list all contacts by hitting a URL under "resources" such as http://localhost:8080/ozarkaddressbook-1.0-SNAPSHOT/resources/contacts (which is handled by https://github.com/pdurbin/addressbookmvc/blob/8c2678de54e23cdd32b914967ce3e8930495f272/examples/ozark/src/main/java/com/greptilian/addressbookmvc/ozark/PeopleController.java ) but it's not clear to me how I would list the contacts at the home page at http://localhost:8080/ozarkaddressbook-1.0-SNAPSHOT/ (which is https://github.com/pdurbin/addressbookmvc/blob/8c2678de54e23cdd32b914967ce3e8930495f272/examples/ozark/src/main/webapp/index.html ).

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.