vapor / docs Goto Github PK
View Code? Open in Web Editor NEW📖 Documentation markdown for all Vapor packages.
Home Page: https://docs.vapor.codes
License: Other
📖 Documentation markdown for all Vapor packages.
Home Page: https://docs.vapor.codes
License: Other
Some documentation describing:
Vapor3: Dokumentation of Fluent; see https://docs.vapor.codes/3.0/fluent/querying/#response
Example yields a compiler error -> return type should probably be changed to Future?
https://docs.vapor.codes/3.0/fluent/querying/
Fluent Querying has incorrect code like this:
router.post(...) { req in
return req.withConnection(to: .foo) { db -> Future<User> in
let user = User(name: "Vapor", age: 3)
return user.save(on: db).transform(to: user) // Future<User>
}
}```
The provider docs are not up-to-date anymore
For many people it is can be something rather useful that up until a few minutes ago I was convinced wasn't possible with Fluent.
It would be great to see some documentation added about custom migration structs for changing fluent schema.
Both explanation of how to build one
How to register it with droplet
How to run the command
Add documentation for SoftDeletable and force deletion.
Docs Path:
https://github.com/vapor/documentation/blob/master/2.0/docs/vapor/droplet.md
config.addConfigurable(log: MyEmailLogger.self, name: "email")
might be:
config.addConfigurable(log:MyEmailLogger.init, name: "email")
https://github.com/vapor/documentation/blob/vapor3/3.0/docs/routing/async.md#asynchronous-routing
let router: AsyncRouter = app.make(AsyncRouter.self)
AsyncRouter = Router.self
try app.make
AsyncRouter is not a valid type
router.on(
.on method needs to be .post, .update, .delete and .get etc
Say I'm in Auth.User section, after reading that section I tap on Auth.Middleware, then the left navigation bar scrolls back on top, which is inconvenient and makes the doc feel un-polished
At https://vapor.github.io/documentation/testing/basic.html there's a following statement made about setting up a Droplet for testing:
Droplet(arguments: ["dummy/path/", "prepare"], ...
The arguments: parameter in our Droplet creation. This is rarely used except for advanced situations, but we'll use it here in testing to ensure that our Droplet doesn't try to automatically serve and block our thread. You can use arguments besides "prepare", but unless you're doing something specific for an advanced situation, these arguments should suffice.
It would be helpful if the documentation here, and also in Droplet initialization, would explicitly make it clear that the 1st argument in that argument list maps to the argv passed into the app (and such the first argument is the executable name – therefore it's just "dummy/path" when you initialize a Droplet in context of tests).
As a fundamental concept within Vapor, references to Node within the documentation (currently) assume an understanding in the context node
is being used.
I often find myself wanting to understand more around the concepts and transforms taking place between the request - to - backend representation of Node.
Topics: NodeRepresentable, Node, makeNode
Hi, I am trying to figure out what are the HTTP methods used for each action in a Resource controller as shown here
var index: Multiple?
var store: Multiple?
var show: Item?
var replace: Item?
var modify: Item?
var destroy: Item?
var clear: Multiple?
var aboutItem: Item?
var aboutMultiple: Multiple?
So index
and show
uses GET. destroy
uses DELETE, but how about the others? The documentation could have something like
var index: Multiple? // GET
var store: Multiple?
var show: Item? // GET
var replace: Item?
var modify: Item?
var destroy: Item? // DELETE
var clear: Multiple?
var aboutItem: Item?
var aboutMultiple: Multiple?
or a table showing also the resource path i.e
index : GET controller/index
show : GET controller/1
destroy : DELETE controller/1
Outline creating Preparation
s outside of just those that come with creating Model
s.
here vapor/vapor#723 i see an install command for brew
:
$ brew install vapor/tap/toolbox
but this is not included in the documentation at https://vapor.github.io/documentation/
3.0/docs/async/overview.md
DispatchQueue.global() {
…should read…
DispatchQueue.global(qos: .background).async {
...or...
DispatchQueue.main.async() {
I have a fork that includes a scraper example I was messing around with, but I decided it was maybe too far out of the documentation topic purview to pull, and anyway I'm too dumb to know if this should go on the main thread or a background. https://github.com/EricWVGG/documentation/3.0/docs/async/overview.md
more: https://stackoverflow.com/questions/37805885/how-to-create-dispatch-queue-in-swift-3
The Vapor 2.0 getting started documentation page
https://docs.vapor.codes/2.0/getting-started/install-on-macos/
has an "edit" button that links to the 3.0 url which fails with a 404 error.
https://github.com/vapor/documentation/edit/master/3.0/docs/getting-started/install-on-macos.md
This is probably two separate issues.
The 2.0 documentation links to the 3.0 folder on the master branch which leads to a 404. After looking at the documentation it looks like it just requires a redeploy as the edit uri appears to be correct. e.g. https://github.com/vapor/documentation/edit/master/3.0/docs/index.md taken from https://docs.vapor.codes/2.0/
The 3.0 edit uri was just incorrect. I'm about to send a PR to fix it.
dyld: Library not loaded: @rpath/libswiftCoreFoundation.dylib
Referenced from: /usr/local/bin/vapor
Reason: image not found
Abort trap: 6
As 3.0 has now been released, I'd love to take it for a spin. However, the page on Relations is still missing details and says "coming soon": https://docs.vapor.codes/3.0/fluent/relations/
Others under Fluent are similar, including Pivot, Transactions, and Database.
Document the Timestampable protocol.
The vapor doc URLs https://docs.vapor.codes/2.0/
and https://docs.vapor.codes/3.0/
responds OK.
However, https://docs.vapor.codes/2.0
and https://docs.vapor.codes/3.0
timeout.
After the connections times out, then the URLs that timed out show as https://docs.vapor.codes:8080/2.0/
and https://docs.vapor.codes:8080/3.0/
in the browser navigaton bar.
So, my exiting vapor doc bookmarks (that used to work) needed to be updated with the appended /
.
Relocated from vapor/website#17
After running the vapor new
command for the Hello, World documentation, I can't find the func build(_ builder: RouteBuilder) throws
line in the file. Instead I found func setupRoutes() throws
. Please update the docs so newbies like me can follow them correctly.
Show how to make generic controllers.
I followed the tutorial and at "Content" -> "Request"
router.post("login") { req -> Future<HTTPStatus> in
return req.content.decode(LoginRequest.self).map(to: HTTPStatus.self) { loginRequest in
print(loginRequest.email) // [email protected]
print(loginRequest.password) // don't look!
return .ok
}
}
results first in an error that content.decode is using a throw, so it can easily be fixed encapsulating it in a try block.
try {
router.post("login") { req -> Future<HTTPStatus> in
return req.content.decode(LoginRequest.self).map(to: HTTPStatus.self) { loginRequest in
print(loginRequest.email) // [email protected]
print(loginRequest.password) // don't look!
return .ok
}
}
}
furthermore the closure results in an ambiguous error, because the return value cannot be
determined. So put in a return value for the closure.
return req.content.decode(content: LoginRequest.self).map(to: HTTPStatus) {
LoginRequest -> HTTPStatus in
print(loginRequest.email)
print(loginRequest.password)
return .ok
}
But this just descalades the ambiguous reference error and now the ".map" member says its ambiguous. I defined the return type of "decode", but the error persists.
TL;DR:
the official documentation has code which doesn't compile because the return type of HTTPRequestStatus cannot be predetermined by the compiler.
In my opinion, your written document is too simple, can in detail, such as the use of the Leaf can write a detailed example of this.And feel a lot of places need to update, such as the Model should be obey the RowConvertible agreement now.But in the document or observe NodeInitializable and NodeRepresentable agreement.This is beginning to make me very confused, and learning together with difficulty.
documentation/3.0/docs/database-kit/overview.md line 59
The closure requires a description of what is being returned. ex.
app.withNewConnection(to: .sqlite) { conn -> Future<SomeModel> in
Worth noting that app.withNewConnection(to:closure:) is useful beyond DatabaseKit. I just had success using it to save to database via Fluent inside of a Command. If a section for Container is ever added, it may make sense to move this there, and refer from DatabaseKit and Fluent. Otherwise, Fluent might benefit from a reference to this page.
I tried implementing the prepare
method for a custom migration for SQLite. However found the documentation really difficult to follow and ultimately didn't work. I was following the steps outlined under the prepare
section in Fluent -> Migrations for Vapor 3.0
The current example for prepare
uses MySQLConnection
, which I just assumed I can substitute out for SQLiteConnection. However doing so causes a 'SQLiteConnection' has no member 'create'
build error.
Thought it maybe a SQLite specific issue, however looking under the Fluent SQLite section just redirects to the more general Fluent -> Migration section.
Would be great to have working documentation on this process! Not sure if this a SQLite specific issue or how this documentation is generalised to all Fluent providers...
I am using Vapor 3.0.0 and FluentSQLite 3.0.0-rc2.2
The Validation section of documentation is currently out of date so much that unless I'm doing something horribly wrong when it comes to the code, even the first snippet of code isn't applicable to the current version of the Validation package – I don't think the Valid<Validator>
class is contained in the current version of package, is it?
At this point, I am afraid I'm not even sure how to start with this surely important package.
It appears the example for JWT Signers is a bit outdated. https://github.com/vapor/documentation/blob/master/2.0/docs/jwt/overview.md#custom-signers. @tanner0101 and I had a conversation on slack https://qutheory.slack.com/archives/C0N6LGM0W/p1502385156074524 regarding how the signers should actually work.
The current documentation shows
{
"signers": [
{
"type": "rsa",
"kid": "1234",
"algorithm": "rs256",
"key": "yourkeyhere"
}
]
}
and it should be
{
"signers": {
"signer": {
"type": "rsa",
"kid": "1234",
"algorithm": "rs256",
"key": "yourkeyhere"
}
}
}
https://docs.vapor.codes/3.0/command/overview/
func run(using context: CommandContext) throws -> Future {
compiler complains: “reference to generic type ‘Future’ (aka ‘EventLoopFuture’) requires arguments in <...>”
Can be solved by changing to:
func run(using context: CommandContext) throws -> Future<Void> {
The docs use a bad instruction for installing Vapor via Homebrew:
This is the command from the link:
brew install vapor/tap/vapor
When running this, Homebrew fails because it tries to clone a nonexistent repository:
https://github.com/vapor/homebrew-cask
I'm not sure what the correct remedy is, if it's updating the Homebrew script or updating the instructions. I did follow the instructions from Vapor Forums and those worked.
let package = Package(
name: "MyApp",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 0),
.Package(url: "https://github.com/vapor/mysql-provider.git", majorVersion: 1, minor: 0)
]
)
It's important to vapor clean or vapor build --clean after adding new packages.
I found runningvapor clean
, an error will be reported later, missing dependencies, this attempt to use vapor build
, there is no mistake.
But add this .Package(url: "https://github.com/vapor/mysql-provider.git", majorVersion: 1, minor: 0)
problems arising from the lack of how to solve other dependencies.?
Of course, I do not understand English... ...
when i do
Display this :
ld: library not found for -lCLibreSSL for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I do? I'm a newbie... ...
Clarify that the libraries are not thread safe and require being run on a single thread.
On page:
https://vapor.github.io/documentation/guide/droplet.html
the link to Logging here in text "The environment affects Config and Logging.":
https://vapor.github.io/documentation/guide/log.html
is a 404.
Add a search functionality to the docs. Possibly couscous provides an easy way of doing this.
getting started docs should also link to some general swift learning resources where possible. for this issue, a link to the swift book on getting started page would be nice.
Link doesn't work.
Dark theme support would be nice. There are a couple of Material dark theme forks, though I'm not sure if MKDocs supports multiple themes (or if a theme selector is provided).
Solutions:
3.0/dark/
) on each versiondark/3.0
)Docs location => https://docs.vapor.codes/2.0/redis/package/
when i install current redis-provide version 1 with Vapor 2,i got unsatisfied dependencies :
.Package(url: "https://github.com/vapor/redis-provider.git", majorVersion: 1)
might be:
.Package(url: "https://github.com/vapor/redis-provider.git", majorVersion: 2)
The code has already been updated: https://github.com/vapor/vapor/tree/master/Sources/Vapor/Sessions but said section hasn't been included in the docs yet.
Link to 2.0's section: https://github.com/vapor/documentation/blob/master/2.0/docs/sessions/sessions.md
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.