-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
43 lines (34 loc) · 815 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require_once __DIR__ . '/vendor/autoload.php';
use FastApi\Core\App;
use FastApi\Facades\Route;
$app = new App("127.0.0.1", 8000);
$app->init(true);
Route::get('/', function () {
return json_encode([
'msg' => 'Welcome to FastApi Framework',
]);
});
Route::get('/users', function () {
return json_encode([
['id' => 1, 'name' => 'mohamed'],
['id' => 2, 'name' => 'samir']
]);
});
Route::post('/users/{id}/edit', function ($id) {
return json_encode([
'msg' => 'edit',
'id' => $id
]);
});
Route::get('/users/{id}/edit/{user}', function () {
return json_encode([
'msg' => 'msg',
]);
});
Route::get('/users/{id}/edit/{user}/{user2}', function () {
return json_encode([
'msg' => 'msg2',
]);
});
$app->listen();