Giter VIP home page Giter VIP logo

tirest's Introduction

TiREST

TiREST is a very tiny, tiny framework for providing RESTful API in LAN between iPad. Currently, support a simple path pattern with HTTP GET/POST/PUT. Note that this is experimental software now.

This software is distributed under the Modified BSD License. You can see the detail in LICENSE.txt.

In this software, CocoaHTTPServer is used.

Required (runtime) environment

  • iOS 5.0 or 5.1
  • CFNetwork.framework and Security.framework must be linked

First example

You can start TiREST with the following simple example codes:

#import <TiREST/TiREST.h>

@interface HelloRouter : TRCinatraRouter

@end
#import "HelloRouter.h"

@implementation HelloRouter

- (void)configure {
  [self get:@"/" on:^(TRAction* action, NSDictionary* params, NSData* body) {
      return [action successWithText:@"<html><head><title>Hello, TiREST</title></head><body><h1>Hello, TiREST</h1>"];
   }];
}
@end
#import <TiREST/TiREST.h>
...
TRTiRESTServer* server = [TRTiRESTServer newServer:12345 routerClass:[HelloRouter class]];
    
NSError* error = nil;
if(![server start:&error]) {
  DDLogError(@"Error starting HTTP Server: %@", error);
} 
...

After the folowing code is executed and the return value is YES, then a tiny HTTP server starts with specified port number in your iPad or iOS simulator.

[server start:&error];

After you access URL "http://your_device_name:12345/" (iPad) or "http://localhost:12345/" (Simulator) with your web browser, "Hello, TiREST" will be shown in your web browser.

Note

The documentation of the library is not enough. If you would like to know the detail, see the source codes. Specifically, tests under Tests directory would be helpful.

tirest's People

Contributors

soutaro avatar

Stargazers

 avatar Kota Mizushima avatar Willi Wu avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

soutaro

tirest'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.