-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#98] Add demo app inside SPM target
- Loading branch information
1 parent
3f9eefa
commit d0aa6ee
Showing
7 changed files
with
113 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// AppDelegate.h | ||
// | ||
// | ||
// Created by Cătălin Stan on 16/09/2022. | ||
// | ||
|
||
#import <Criollo/Criollo.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface AppDelegate : NSObject <CRApplicationDelegate> | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// AppDelegate.m | ||
// | ||
// | ||
// Created by Cătălin Stan on 16/09/2022. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
|
||
@interface AppDelegate () | ||
|
||
@property (readonly) CRHTTPServer *server; | ||
|
||
@end | ||
|
||
@implementation AppDelegate | ||
|
||
- (instancetype)init { | ||
self = [super init]; | ||
if (self) { | ||
_server = [CRHTTPServer new]; | ||
} | ||
return self; | ||
} | ||
|
||
#pragma mark - CRApplicationDelegate | ||
|
||
- (void)applicationDidFinishLaunching:(NSNotification *)notification { | ||
[self.server add:^(CRRequest *request, CRResponse *response, CRRouteCompletionBlock completionHandler) { | ||
[response send:@"Hello world"]; | ||
}]; | ||
|
||
[self.server startListening]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// main.m | ||
// | ||
// | ||
// Created by Cătălin Stan on 16/09/2022. | ||
// | ||
|
||
#import <Criollo/Criollo.h> | ||
|
||
#import "AppDelegate.h" | ||
|
||
int main(int argc, const char * argv[]) { | ||
return CRApplicationMain(argc, argv, [AppDelegate new]); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// AppDelegate.swift | ||
// | ||
// | ||
// Created by Cătălin Stan on 15/09/2022. | ||
// | ||
|
||
import Criollo | ||
|
||
class AppDelegate: CRApplicationDelegate { | ||
|
||
private lazy var server = CRHTTPServer() | ||
|
||
// MARK: - CRApplicationDelegate | ||
|
||
func applicationDidFinishLaunching(_ notification: Notification) { | ||
server.add { _, res, _ in | ||
res.send("Hello world!") | ||
} | ||
server.startListening() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// | ||
// main.swift | ||
// | ||
// | ||
// Created by Cătălin Stan on 15/09/2022. | ||
// | ||
|
||
import Criollo | ||
|
||
exit(CRApplicationMain(CommandLine.argc, nil, AppDelegate())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters