generated from lucien/actix-react-template
i added db and articles end points
This commit is contained in:
parent
c992014d53
commit
57d574d143
4 changed files with 43 additions and 3 deletions
15
back/src/creat_db.rs
Normal file
15
back/src/creat_db.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use sqlite::{Connection, State};
|
||||
|
||||
fn main() -> sqlite::Result<()> {
|
||||
let conn = Connection::open("./data/data.db")?;
|
||||
|
||||
conn.execute(
|
||||
"CREATE TABLE articles (
|
||||
id INTEGER PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
subTitle TEXT,
|
||||
content TEXT NOT NULL,
|
||||
)",
|
||||
[],
|
||||
)?;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue