Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos-rs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos-rs
Commits
79431d64
Commit
79431d64
authored
Nov 20, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add todo cards service
parent
f35f1919
Pipeline
#18037
failed with stages
in 5 minutes and 49 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
src/main.rs
src/main.rs
+15
-4
src/service/cards/mod.rs
src/service/cards/mod.rs
+3
-0
src/service/mod.rs
src/service/mod.rs
+2
-0
No files found.
src/main.rs
View file @
79431d64
...
...
@@ -4,13 +4,15 @@ use warp::Filter;
mod
infra
;
mod
service
;
const
ADDR
:
&
str
=
"127.0.0.1:3030"
;
// TODO: Configurable
const
DECK_ADDR
:
&
str
=
"127.0.0.1:3030"
;
const
CARDS_ADDR
:
&
str
=
"127.0.0.1:3033"
;
#[tokio::main]
async
fn
main
()
->
anyhow
::
Result
<
()
>
{
pretty_env_logger
::
try_init
()
?
;
//
todo
: use CORS correctly
//
TODO
: use CORS correctly
let
cors
=
warp
::
cors
()
.allow_any_origin
()
.allow_credentials
(
true
)
...
...
@@ -19,9 +21,18 @@ async fn main() -> anyhow::Result<()> {
let
deck
=
warp
::
path!
(
"deck"
/
String
)
.map
(
service
::
deck_service
)
.with
(
cors
);
.with
(
cors
.clone
());
warp
::
serve
(
deck
)
.run
(
SocketAddr
::
from_str
(
DECK_ADDR
)
?
)
.await
;
warp
::
serve
(
deck
)
.run
(
SocketAddr
::
from_str
(
ADDR
)
?
)
.await
;
// TODO: cards服务暂时仅支持单卡查询
let
cards
=
warp
::
path!
(
"cards"
/
String
)
.map
(
service
::
cards_service
)
.with
(
cors
);
warp
::
serve
(
cards
)
.run
(
SocketAddr
::
from_str
(
CARDS_ADDR
)
?
)
.await
;
Ok
(())
}
src/service/cards/mod.rs
0 → 100644
View file @
79431d64
pub
fn
service
(
param
:
String
)
->
String
{
todo!
()
}
src/service/mod.rs
View file @
79431d64
mod
cards
;
mod
deck
;
pub
use
cards
::
service
as
cards_service
;
pub
use
deck
::
service
as
deck_service
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment