1 Star 0 Fork 0

Damon/DartServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0
dart_server ======== this start a http server for flutter web, it can also proxy api requests for Cross-Origin Request. Feature -------- 1. Start a http server at local static directory. 2. Proxy api requests for Cross-Origin Request. Run -------- > need install dart sdk,can execute dart command ```java # install dependence flutter pub get # start dart lib/server.dart ``` Config -------- - Config port, for example: ```java var server = await http.startServer('127.0.0.1', 3000); ``` - Config api proxy, for example: ```java var pubProxy = Proxy( 'https://pub.dev', publicPath: '', timeout: timeout, ); ``` - Config local static directory , for example: ```java var fs = const LocalFileSystem(); var vDir = CachingVirtualDirectory( app, fs, allowDirectoryListing: true, source: fs.currentDirectory.parent.childDirectory("build").childDirectory("web"), maxAge: const Duration(days: 24).inSeconds, ); ``` 中文: --------- dart_server ======== 为flutter web启动一个http服务器,并且可以代理api请求,解决跨域请求问题。 功能 -------- 1. 为本地文件夹启动一个http服务,例如为flutter web的产物启动http服务 2. 通过接口代理 解决flutter web调用接口时跨域问题 执行 -------- > 需要安装dart sdk,可以运行dart命令 ```java # 安装依赖 flutter pub get # 启动服务 dart lib/server.dart ``` 配置 -------- - 配置端口号, 例如: ```java var server = await http.startServer('127.0.0.1', 3000); ``` - 配置接口代理, 例如: ```java var pubProxy = Proxy( 'https://pub.dev', publicPath: '', timeout: timeout, ); ``` - 配置本地文件夹地址 , 例如: ```java var fs = const LocalFileSystem(); var vDir = CachingVirtualDirectory( app, fs, allowDirectoryListing: true, source: fs.currentDirectory.parent.childDirectory("build").childDirectory("web"), maxAge: const Duration(days: 24).inSeconds, ); ``` # Contact me: - Blog:http://blog.csdn.net/masonblog - Email:MasonLiuChn@gmail.com License ======= Copyright 2019 MasonLiu, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

this start a http server for flutter web, it can also proxy api requests for Cross-Origin Request.为flutter web启动一个http服务器,并且可以代理api请求,解决跨域请求问题。 展开 收起
Dart
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Dart
1
https://gitee.com/damonliuchn/DartServer.git
git@gitee.com:damonliuchn/DartServer.git
damonliuchn
DartServer
DartServer
master

搜索帮助