/api -> /form
API endpoints will be added later
This commit is contained in:
parent
73454ac4c8
commit
49899b6f34
3 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,7 @@ use futures::{StreamExt, TryStreamExt};
|
|||
use ntex::web::{self, Error, HttpResponse};
|
||||
use ntex_multipart::Multipart;
|
||||
|
||||
#[web::post("/api/upload")]
|
||||
#[web::post("/form/upload")]
|
||||
async fn upload(mut payload: Multipart) -> Result<HttpResponse, Error> {
|
||||
while let Ok(Some(mut field)) = payload.try_next().await {
|
||||
println!("CT: {:?}", field.content_type());
|
|
@ -1,7 +1,7 @@
|
|||
use ntex::web::{self, App};
|
||||
use ntex_files;
|
||||
|
||||
mod api;
|
||||
mod form;
|
||||
mod pages;
|
||||
|
||||
#[ntex::main]
|
||||
|
@ -9,7 +9,7 @@ async fn main() -> std::io::Result<()> {
|
|||
web::server(move || {
|
||||
App::new()
|
||||
.service(pages::index)
|
||||
.service(api::upload)
|
||||
.service(form::upload)
|
||||
.service(ntex_files::Files::new("/static", "./static"))
|
||||
})
|
||||
.bind("127.0.0.1:3002")?
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</header>
|
||||
<input type="radio" name="tab" class="htab" id="htab-file" aria-hidden="true" checked>
|
||||
<input type="radio" name="tab" class="htab" id="htab-link" aria-hidden="true">
|
||||
<form action="/api/upload" method="post" enctype="multipart/form-data" id="tab-file" role="tabpanel">
|
||||
<form action="/form/upload" method="post" enctype="multipart/form-data" id="tab-file" role="tabpanel">
|
||||
{{> no-auto-submit }}
|
||||
<div class="form-main">
|
||||
{{> file }}
|
||||
|
@ -45,7 +45,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="/api/shorten" method="post" id="tab-link" role="tabpanel">
|
||||
<form action="/form/shorten" method="post" id="tab-link" role="tabpanel">
|
||||
{{> no-auto-submit }}
|
||||
<div class="form-main">
|
||||
{{> link }}
|
||||
|
|
Loading…
Add table
Reference in a new issue