Skip to content

Commit 5b901d9

Browse files
committed
docs: add quick-start draft
1 parent 1f20ab5 commit 5b901d9

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

docs/quick-start.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
id: quick-start
3+
title: Quick Start
4+
sidebar_label: Quick Start
5+
---
6+
7+
## Quick install guide
8+
if you haven't installed [Rust](https://www.rust-lang.org/) yet, here is a quick guide which using rustup:
9+
```bash
10+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
11+
```
12+
After Rust is installed, you can use cargo to generate a new project:
13+
```bash
14+
cargo new my-app
15+
```
16+
Go to `Cargo.toml` file, add this line:
17+
```toml {10}
18+
[package]
19+
name = "my-app"
20+
version = "0.1.0"
21+
authors = ["Gan Jun Kai <kuhn96@gmail.com>"]
22+
edition = "2018"
23+
24+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
25+
26+
[dependencies]
27+
obsidian = "0.1.0-alpha.1"
28+
```
29+
Go to `main.rs`, add these:
30+
```rust {1,4-11}
31+
use obsidian::App;
32+
33+
fn main() {
34+
let mut app = App::new();
35+
let addr = ([127, 0, 0, 1], 3000).into();
36+
37+
app.get("/", |_ctx| "Hello World");
38+
39+
app.listen(&addr, || {
40+
println!("server is listening to {}", &addr);
41+
});
42+
}
43+
```
44+
45+
Go to terminal type this to start your server:
46+
```bash
47+
cargo run
48+
```

docusaurus.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ module.exports = {
2929
{
3030
title: 'Docs',
3131
items: [
32+
{
33+
label: 'Quick Start',
34+
to: 'docs/quick-start',
35+
},
3236
{
3337
label: 'Style Guide',
3438
to: 'docs/doc1',

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
module.exports = {
99
someSidebar: {
10+
Introduction: ['quick-start'],
1011
Docusaurus: ['doc1', 'doc2', 'doc3'],
1112
Features: ['mdx'],
1213
},

0 commit comments

Comments
 (0)