[][src]Function parody::start

pub fn start(upstream_url: Url, storage_config: Config) -> Result<Parody, Error>

Starts a server at random port at localhost

With this function you can configure your Parody server precisely

Example

use std::str::FromStr;
use std::path::Path;
let storage_config = parody::storage::Config::default().with_root_dir(Path::new("/tmp/parody/example.com").to_owned());
let upstream_url = url::Url::from_str("http://example.com").unwrap();
let parody = parody::start(upstream_url, storage_config).unwrap();
println!("PARODY_IP={}", parody.ip());
println!("PARODY_PORT={}", parody.port());