summaryrefslogtreecommitdiffstats
path: root/atuin-server/src/lib.rs
blob: 36b6ffa75244a198bc526eff8490bcfcc2fcb20b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::net::IpAddr;

use eyre::Result;

use crate::settings::Settings;

#[macro_use]
extern crate log;

#[macro_use]
extern crate serde_derive;

pub mod auth;
pub mod database;
pub mod handlers;
pub mod models;
pub mod router;
pub mod settings;

pub async fn launch(settings: &Settings, host: String, port: u16) -> Result<()> {
    // routes to run:
    // index, register, add_history, login, get_user, sync_count, sync_list
    let host = host.parse::<IpAddr>()?;

    let r = router::router(settings).await?;

    warp::serve(r).run((host, port)).await;

    Ok(())
}