import Vapor
let app = try await Application.make(.detect())
app.get("hello") { req in
"Hello, world!"
}
try await app.execute()
Build efficient APIs in a language you love. Create routes, send and receive JSON and build HTTP servers.
Learn MoreCreate models and interact with your database in native, safe Swift code without needing to write any SQL
Learn MoreA templating engine written in Swift. Generate HTML for both web apps and emails with a simple syntax anyone can use
Learn MoreBuilt with a non-blocking, event-driven architecture, Vapor allows you to build high-performant, scalable APIs and HTTP servers. Using Swift's Concurrency model, you can write clear, maintainable code that's efficient and easy to read.
app.get("todos", ":id") { req async throws -> Todo in
let id: UUID = try req.parameters.require("id")
guard
let todo = try await Todo.find(id, on: req.db)
else {
throw Abort(.notFound)
}
return todo
}
With Vapor's expressive, protocol oriented design, you'll have peace of mind when shipping your code. With our strong type-safety focus, many errors and problems are caught early on by the compiler.
func search(req: Request) async throws -> [Todo] {
let name: String = try req.query.get(at: "name")
let results = try await Todo.query(on: req.db)
.filter(\.$number == name)
.all()
return results
}
Vapor's mature ecosystem includes over a hundred official and community maintained server-first Swift packages to make building your applications easy and efficient.
SwiftFiddle is an online playground for creating, sharing and embedding Swift fiddles
See it in actionThe Swift Package Index is a searchable index of Swift packages and their compatibility with various platforms.
See it in actionQuickly locate yourself on the official MTA map of NYC and get real-time train arrivals at that subway stop
See it in actionLitmaps is a browser-based research platform designed for clarity, comprehensiveness, and collaboration.
See it in actionVapor's 13k+ Discord community will be at your side to support you along the way. Ask questions, contribute and be a part of a thriving, wholesome corner of the internet.
ContributeEmerge Tools is a suite of revolutionary products designed to supercharge mobile apps and the teams that build them.
Learn More