在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):lucperkins/rust-graphql-juniper-actix-diesel-postgres开源软件地址(OpenSource Url):https://github.com/lucperkins/rust-graphql-juniper-actix-diesel-postgres开源编程语言(OpenSource Language):Rust 88.7%开源软件介绍(OpenSource Introduction):Rust + GraphQL + Juniper + Diesel + Postgres + ActixYes, I know that this is a borderline absurd web stack for the ubiquitous TODO application but I had a lot of trouble getting this all to work. I started using these things for a more ambitious project and I'd love to spare you the trouble. So here's some basic boilerplate to get you up and running. ComponentsHere's what does what:
Run locally
# Fetch the repo
git clone https://github.com/lucperkins/rust-actix-diesel-postgres-juniper
cd rust-actix-diesel-postgres-juniper
# Set up the database
cp .env.example .env # Modify this file to match your Postgres installation
diesel setup
diesel migration run
cargo run # could take a while!
Once the server is running, you can access the GraphQL Playground UI at http://localhost:4000/graphql. SchemaThe server implements the following GraphQL schema: type Todo {
id: ID!
task: String!
done: Boolean!
}
input CreateTodoInput {
task: String!
done: Boolean
}
type Query {
allTodos: [Todo!]!
getTodoById(id: Int): Todo
}
type Mutation {
createTodo(input: CreateTodoInput): Todo
markTodoAsDone(id: Int): Todo
markTodoAsNotDone(id: Int): Todo
}
schema {
Query
Mutation
} Tour of the codebase
Future TODOsGet it? Anyway, here's some areas for improvement (pull requests very much welcome):
AcknowledgmentsI'm basically a beginner with Rust and would not have been able to put this together without peeking long and hard at the example projects and blog posts listed below. The lower-level bits you see here are basically stolen from BrendanBall. All that I've added is the Example projects
Blog posts |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论