Perubahan handler di pertemuan selasa kemarin

This commit is contained in:
Dita Aji Pratama 2025-06-07 14:20:45 +07:00
parent eb8c96233c
commit e03d4eced2
2 changed files with 18 additions and 2 deletions

View File

@ -4,7 +4,7 @@ host = "localhost"
port = 11000
reloader = False
debug = False
server = 'gunicorn' # default = 'wsgiref'
server = 'wsgiref' # default = 'wsgiref'
session_opts = {
'session.type': 'file',

View File

@ -5,9 +5,11 @@
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
from bottle import Bottle, route
from bottle import Bottle, route, request, response
from config import directory
import json
import templates.plain.main as template_public
import modules.public.home as public_home
@ -21,3 +23,17 @@ def index():
}
}
return public_home.main().html(params)
@app.route('/api/<crud>', method=['GET', 'POST', 'OPTIONS', 'PUT', 'DELETE'] )
def contoh(crud):
response.content_type = 'application/json'
params = request.json
keluaran = {
"status":"success",
"Message":"API SUKSES!",
"endpoint":f"/api/{crud}"
}
return json.dumps(keluaran).encode()