-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from fatkulnurk/dev
Merge From Dev
- Loading branch information
Showing
21 changed files
with
542 additions
and
242 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,92 +1,9 @@ | ||
<?php | ||
|
||
use Fatkulnurk\Microframework\Http\Message\Response; | ||
use Fatkulnurk\Microframework\Routing\RouteCollector; | ||
|
||
return function (RouteCollector $r) { | ||
$r->addRoute('GET', '/', function ($args) { | ||
|
||
var_dump(\Fatkulnurk\Microframework\Http\Message\ServerRequest::getInstance() | ||
->make('GET', $_SERVER['REQUEST_URI'])->getUri()); | ||
|
||
die(); | ||
return Response::getInstance() | ||
->withView('index', [ | ||
'name' => 'fatkul nur koirudin', | ||
'birthday' => '18 januari 1999' | ||
], new \Fatkulnurk\Microframework\Http\Data\View\Page()); | ||
|
||
// /* Contoh return data view tanpa template factory */ | ||
// return Response::getInstance() | ||
// ->withView('index', [ | ||
// 'name' => 'fatkul nur k', | ||
// 'birthday' => '18 januari 1999' | ||
// , new \Fatkulnurk\Microframework\Http\Data\View\LexTemplateFactory()]); | ||
}); | ||
|
||
$r->addRoute('GET', '/tes-json', function ($args) { | ||
$data = [ | ||
'biodata' => [ | ||
'nama' => 'fatkul nur koirudin', | ||
'ttl' => 'Lamongan, 18 Januari 1999', | ||
'alamat' => [ | ||
'desa' => 'Desa Ngambeg', | ||
'kecamatan' => 'Kecamatan Pucuk', | ||
'kabupaten' => 'Kabupaten Lamongan' | ||
], | ||
'email' => 'fatkulnurk@gmail.com', | ||
'hoby' => [ | ||
'memancing', | ||
'belajar hal baru' | ||
] | ||
] | ||
]; | ||
|
||
return Response::getInstance() | ||
->withJson($data); | ||
}); | ||
|
||
$r->addRoute('GET', '/tes-redirect', function ($args) { | ||
return Response::getInstance() | ||
->withRedirect('http://google.com'); | ||
echo "Hello World"; | ||
}); | ||
|
||
$r->addRoute('GET', '/biodata', function ($args) { | ||
echo json_encode([ | ||
'biodata' => [ | ||
'nama' => 'fatkul nur koirudin', | ||
'ttl' => 'Lamongan, 18 Januari 1999', | ||
'alamat' => [ | ||
'desa' => 'Desa Ngambeg', | ||
'kecamatan' => 'Kecamatan Pucuk', | ||
'kabupaten' => 'Kabupaten Lamongan' | ||
], | ||
'email' => 'fatkulnurk@gmail.com', | ||
'hoby' => [ | ||
'memancing', | ||
'belajar hal baru' | ||
] | ||
] | ||
]); | ||
header('Content-Type: application/json'); | ||
}); | ||
|
||
$r->addRoute('GET', '/home', function ($args) { | ||
echo "aa"; | ||
}); | ||
|
||
$r->addRoute('GET', '/user/{id:\d+}[/{name}]', function ($args) { | ||
var_dump($args); | ||
}); | ||
|
||
$r->addRoute('GET', '/test/{name}', 'Coba::index'); | ||
}; | ||
|
||
// testing handler | ||
class Coba | ||
{ | ||
public function index() | ||
{ | ||
echo "Aaaa"; | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.