# Magician-Route **Repository Path**: jmagician/Magician-Route ## Basic Information - **Project Name**: Magician-Route - **Description**: Magician-Route是由Magician-Web发展而来,主要是去掉了里面的反射,牺牲了一点易用性,将侧重点放在了性能上 - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: https://magician-io.com - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-11-21 - **Last Updated**: 2024-10-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Magician-Route ·

Magician-Route is the official web component of Magician, which was developed from Magician-Web, mainly by removing the reflection inside, sacrificing a bit of ease of use and putting the focus on performance. ## Documentation [https://magician-io.com](https://magician-io.com) ## Example ### Importing dependencies ```xml com.github.yuyenews Magician-Route 1.0.0 com.github.yuyenews Magician 2.0.7 org.slf4j slf4j-jdk14 1.7.12 ``` ### Creating core handlers ```java @HttpHandler(path="/") public class DemoHandler implements HttpBaseHandler { @Override public void request(MagicianRequest magicianRequest, MagicianResponse response) { try{ MagicianRoute.request(magicianRequest); } catch (Exception e){ } } } ``` ### Creating Route ```java @Route public class DemoRoute implements MagicianInitRoute { @Override public void initRoute(MagicianRouteCreate routeCreate) { routeCreate.get("/demo/getForm", request -> { DemoVO demoVO = ConversionUtil.conversionAndVerification(request, DemoVO.class); System.out.println(request.getParam("name") + "---" + demoVO.getName()); return "{\"msg\":\"hello login\"}"; }); routeCreate.post("/demo/json", request -> { DemoVO demoVO = ConversionUtil.conversionAndVerification(request, DemoVO.class); System.out.println(request.getJsonParam() + "---" + demoVO.getName()); return "{\"msg\":\"hello json\"}"; }); } } ``` ### Start HTTP service ```java Magician.createHttp() .scan("Packages to be scanned") .bind(8080); ```