mirror of https://github.com/vapor/docs.git
568 lines
26 KiB
HTML
568 lines
26 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>Vapor Documentation</title>
|
|
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro">
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Quicksand:400,700,300">
|
|
<link rel="stylesheet" href="/1.5/styles/vapor-code.css">
|
|
<link rel="stylesheet" href="/1.5/styles/main.css">
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<a class="logo" href="/1.5/">
|
|
<img src="/1.5/images/droplet.svg" alt="Vapor">
|
|
<h1>Vapor <em>Docs</em></h1>
|
|
</a>
|
|
<ul>
|
|
<li>
|
|
<a href="http://vapor.codes">Home</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://example.vapor.codes">Example</a>
|
|
</li>
|
|
<li>
|
|
<a href="https://github.com/vapor/vapor">GitHub</a>
|
|
</li>
|
|
<li>
|
|
<a href="https://twitter.com/@codevapor">Twitter</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://vapor.team">Slack</a>
|
|
</li>
|
|
</ul>
|
|
</header>
|
|
|
|
|
|
|
|
<nav>
|
|
<a href="#" class="toggle show">☰</a>
|
|
<a href="#" class="toggle close">×</a>
|
|
|
|
<div class="scroll">
|
|
<section>
|
|
<h3>Getting Started</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/getting-started/install-swift-3-macos.html">
|
|
Install Swift 3: macOS
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/getting-started/install-swift-3-ubuntu.html">
|
|
Install Swift 3: Ubuntu
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/getting-started/install-toolbox.html">
|
|
Install Toolbox
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/getting-started/hello-world.html">
|
|
Hello, World
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/getting-started/manual.html">
|
|
Manual
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/getting-started/xcode.html">
|
|
Xcode
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Guide</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/guide/droplet.html">
|
|
Droplet
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/folder-structure.html">
|
|
Folder Structure
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/json.html">
|
|
JSON
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/config.html">
|
|
Config
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/views.html">
|
|
Views
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/leaf.html">
|
|
Leaf
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/controllers.html">
|
|
Controllers
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/middleware.html">
|
|
Middleware
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/validation.html">
|
|
Validation
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/provider.html">
|
|
Provider
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/sessions.html">
|
|
Sessions
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/hash.html">
|
|
Hash
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/guide/commands.html">
|
|
Commands
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Routing</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/routing/basic.html">
|
|
Basic
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/routing/parameters.html">
|
|
Route Parameters
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/routing/query-parameters.html">
|
|
Query Parameters
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/routing/group.html">
|
|
Group
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/routing/collection.html">
|
|
Collection
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Fluent</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/fluent/driver.html">
|
|
Driver
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/fluent/model.html">
|
|
Model
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/fluent/query.html">
|
|
Query
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/fluent/relation.html">
|
|
Relation
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Auth</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/auth/user.html">
|
|
User
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/auth/middleware.html">
|
|
Middleware
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/auth/request.html">
|
|
Request
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/auth/protect.html">
|
|
Protect
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>HTTP</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/http/request.html">
|
|
Request
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/response.html">
|
|
Response
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/body.html">
|
|
Body
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/response-representable.html">
|
|
ResponseRepresentable
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/responder.html">
|
|
Responder
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/client.html">
|
|
Client
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/server.html">
|
|
Server
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/http/cors.html">
|
|
CORS
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>WebSockets</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/websockets/droplet.html">
|
|
Droplet
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/websockets/custom.html">
|
|
Custom
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Testing</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/testing/modules.html">
|
|
Modules
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/testing/basic.html">
|
|
Basic
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Deploy</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/deploy/nginx.html">
|
|
Nginx
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/deploy/supervisor.html">
|
|
Supervisor
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<h3>Version (1.5)</h3>
|
|
<ul>
|
|
<li class="">
|
|
<a href="/1.5/switch/1_5.html">
|
|
1.5
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="/1.5/switch/2_0.html">
|
|
2.0
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</nav>
|
|
|
|
<main>
|
|
<a href="https://github.com/vapor/documentation/blob/master/CONTRIBUTING.md" class="edit">✎ Edit on GitHub</a>
|
|
<h1 id="documentacin-de-vapor">Documentación de Vapor</h1>
|
|
<p><a href="http://stackoverflow.com/questions/tagged/vapor"><img src="https://img.shields.io/stackexchange/stackoverflow/t/vapor.svg" alt="Stack Overflow" /></a></p>
|
|
<p>Esta es la documentación de Vapor, el <em>framework web</em> para Swift que funciona sobre iOS, macOS y ubuntu; y sobre todos los <em>paquetes</em> que Vapor ofrece.</p>
|
|
<p>Vapor es el <em>framework web</em> más utilizado para Swift. Proporciona una base maravillosamente expresiva y fácil de usar para tu próximo sitio web o API.</p>
|
|
<p>Para ver el código fuente y la documentación del código visita <a href="https://github.com/vapor/vapor">Vapor's GitHub</a>.</p>
|
|
<p>Para leer esto en <a href="https://github.com/vapor/documentation/1.5/readme.zh-hant.html">正體中文</a></p>
|
|
<p>Para leer esto en <a href="https://github.com/vapor/documentation/blob/readme.zh-cn.html">简体中文</a></p>
|
|
<p>Para leer esto en <a href="https://github.com/vapor/documentation/1.5/index.html">English</a></p>
|
|
<h2 id="cmo-leer-esta-documentacin">Cómo leer esta documentación.</h2>
|
|
<p>Puedes leer esta guía haciendo clic en las carpetas y los archivos de <a href="https://github.com/vapor/documentation">GitHub</a> o a través de las páginas generadas <a href="https://vapor.github.io/documentation/">GitHub Pages</a>.</p>
|
|
<h2 id="api">API</h2>
|
|
<p>La documentación de la API generada automáticamente se encuentra en <a href="http://api.vapor.codes">api.vapor.codes</a>.</p>
|
|
<h2 id="paquetes">Paquetes</h2>
|
|
<p>Aquí hay una lista de todos los paquetes y módulos incluidos con Vapor (también <em>utilizables</em> individualmente).</p>
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/vapor">Vapor</a>: Swift el <em>framework web</em> más utilizado.
|
|
<ul>
|
|
<li>Auth: Autenticación y persistencia de usuarios.</li>
|
|
<li>Sessions: Almacenamiento de datos seguro y <em>efímero</em> basado en cookies.</li>
|
|
<li>Cookies: Cookies HTTP.</li>
|
|
<li>Routing: Enrutador avanzado con parametrización segura.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/fluent">Fluent</a>: Modelos, relaciones y consulta de bases de datos NoSQL y SQL.</li>
|
|
<li><a href="https://github.com/vapor/engine">Engine</a>: Capas de transporte principales.
|
|
<ul>
|
|
<li>HTTP: Cliente y servidor HTTP completamente en Swift.</li>
|
|
<li>URI: Parseo y <em>serialización</em> completamente en Swift.</li>
|
|
<li>WebSockets: Canales de comunicación full-duplex a través de una sola conexión TCP. </li>
|
|
<li>SMTP: Envío de correo electrónico con SendGrill y Gmail.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/leaf">Leaf</a>: Un lenguaje de plantillas extensible.</li>
|
|
<li><a href="https://github.com/vapor/json">JSON</a>: Mapas Jay JSON a tipos de Vapor.</li>
|
|
<li><a href="https://github.com/vapor/console">Console</a>: Wrapper en Swift para E/S de consola y comandos.</li>
|
|
<li><a href="https://github.com/vapor/tls">TLS</a>: Wrapper en Swift para el nuevo TLS de CLibreSSL.</li>
|
|
<li><a href="https://github.com/vapor/crypto">Crypto</a>: Criptografía de LibreSSL y Swift.
|
|
<ul>
|
|
<li>Digests: <em>Hashing</em> con y sin autenticación.</li>
|
|
<li>Ciphers: Encriptación y descifrado.</li>
|
|
<li>Random: Pseudo aleatoriedad criptográficamente segura.</li>
|
|
<li>BCrypt: Implementación completamente en Swift.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/node">Node</a>: Estructura de datos para fáciles conversiones de tipo.
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/polymorphic">Polymorphic</a>: Sintaxis para acceder fácilmente a valores de tipos comunes como JSON.</li>
|
|
<li><a href="https://github.com/vapor/path-indexable">Path Indexable</a>: Un protocolo para un acceso poderoso via <em>subscript</em> a tipos comunes como JSON.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/core">Core</a>: Extensiones básicas, <em>alias</em> de tipos, y funciones que facilitan tareas comunes.</li>
|
|
<li><a href="https://github.com/vapor/socks">Socks</a>: <em>API Wrapper</em> para acceder a sockets en C.</li>
|
|
</ul>
|
|
<h2 id="proveedores-y-otros">Proveedores y otros.</h2>
|
|
<p>Aquí hay una lista de proveedores y paquetes de terceros que funcionan muy bien con Vapor.</p>
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/mysql">MySQL</a>: Interface robusta MySQL para Swift.
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/mysql-driver">MySQL Driver</a>: <em>Driver</em> MySQL para Fluent.</li>
|
|
<li><a href="https://github.com/vapor/mysql-provider">MySQL Provider</a>: Proveedor MySQL para Vapor.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/sqlite">SQLite</a>: <em>Wrapper</em> SQLite 3 para Swift
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/sqlite-driver">SQLite Driver</a>: <em>Driver</em> SQLite para Fluent.</li>
|
|
<li><a href="https://github.com/vapor/sqlite-provider">SQLite Provider</a>: Proveedor SQLite provider para Vapor.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/postgresql">PostgreSQL</a>: Interface PostgreSQL robusta para Swift.
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/postgresql-driver">PostgreSQL Driver</a>: <em>Driver</em> PostgreSQL para Fluent.</li>
|
|
<li><a href="https://github.com/vapor/postgresql-provider">PostgreSQL Provider</a>: Proveedor PostgreSQL para Vapor.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/OpenKitten/MongoKitten">MongoKitten*</a>: <em>Driver</em> nativo MongoDB, escrito en Swift
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/mongo-driver">Mongo Driver</a>: <em>Driver</em> MongoKitten para Fluent.</li>
|
|
<li><a href="https://github.com/vapor/mongo-provider">Mongo Provider</a>: Proveedor MongoKitten para Vapor.</li>
|
|
<li><a href="https://github.com/OpenKitten/MainecoonVapor">MainecoonVapor</a>: MongoKitten ORM para Vapor.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/redbird">Redbird</a>: Un cliente Redis completamente en Swift implementado directamente desde la especificación del protocolo.
|
|
<ul>
|
|
<li><a href="https://github.com/vapor/redis-provider">Redis Provider</a>: Proveedor del <em>cache</em> de Redis para Vapor.</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/vapor/kitura-provider">Kitura Provider</a>: Permite usar el servidor HTTP de IBM (Kitura) en Vapor.</li>
|
|
<li><a href="https://github.com/SwiftyBeaver/SwiftyBeaver-Vapor">SwiftyBeaver</a>: Agrega el potente <em>logging</em> de SwiftyBeaver a Vapor.</li>
|
|
<li><a href="https://github.com/matthijs2704/vapor-apns">APNS</a>: Sencilla biblioteca APNS para Vapor (Swift).</li>
|
|
<li><a href="https://github.com/mdab121/vapor-fcm">VaporFCM</a>: Sencilla biblioteca FCM para Vapor.</li>
|
|
<li><a href="https://github.com/siemensikkema/vapor-jwt">JWT</a>: Implementación JWT para Vapor.</li>
|
|
<li><a href="https://github.com/JustinM1/VaporS3Signer">VaporS3Signer</a>: Gerera <em>V4 Auth Header/Pre-Signed URL</em> para <em>AWS S3 REST API</em>.</li>
|
|
<li><a href="https://github.com/jakeheis/Flock">Flock</a>: <em>Despliegue</em> automatizado de proyectos Swift en servidores.
|
|
<ul>
|
|
<li><a href="https://github.com/jakeheis/VaporFlock">VaporFlock</a>: Utiliza Flock para <em>desplegar</em> aplicaciones de vapor</li>
|
|
</ul></li>
|
|
<li><a href="https://github.com/bygri/vapor-forms">VaporForms</a>: Brinda a Vapor un manejo de formularios web simple, dinámico y <em>reutilizable</em>.</li>
|
|
<li><a href="https://github.com/BrettRToomey/Jobs">Jobs</a>: Un sistema minimalista para ejecutar <em>jobs</em>/tareas en <em>2o plano</em> para Swift.</li>
|
|
<li><a href="https://github.com/himani93/heimdall">Heimdall</a>: Un <em>logger</em> de <em>requet's</em> HTTP fácil de usar.</li>
|
|
</ul>
|
|
<h2 id="autores">Autores</h2>
|
|
<p><a href="mailto:tanner@qutheory.io">Tanner Nelson</a>, <a href="mailto:logan@qutheory.io">Logan Wright</a>, y los cientos de miembros de Vapor.</p>
|
|
</main>
|
|
|
|
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
|
<script src="/1.5/scripts/highlight.pack.js"></script>
|
|
|
|
<script>
|
|
hljs.registerLanguage("leaf", function (hljs) {
|
|
/* Author: Hale Chan <halechan@qq.com> */
|
|
return {
|
|
c: [
|
|
{
|
|
cN: 'function',
|
|
b: '#+',
|
|
e: '[)] ',
|
|
rB: true,
|
|
eE: false,
|
|
c : [
|
|
{
|
|
b: '[(]',
|
|
e: '[)]',
|
|
eE: true,
|
|
c: [
|
|
{
|
|
cN: 'string',
|
|
b: '"',
|
|
e: '"'
|
|
},
|
|
{
|
|
cN: 'title',
|
|
b: '[A-Za-z_][A-Za-z_0-9]*'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
cN: 'keyword',
|
|
b: '#+([A-Za-z$_][0-9A-Za-z$_]*)?',
|
|
eP: true
|
|
},
|
|
]
|
|
}
|
|
]
|
|
};
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
$(function() {
|
|
// Syntax highlighting
|
|
hljs.initHighlightingOnLoad();
|
|
|
|
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
|
|
$('body').addClass('safari');
|
|
}
|
|
|
|
$('h1, h2, h3, h4, h5, h6').each(function(key, item) {
|
|
var $item = $(item);
|
|
var id = $item.attr('id');
|
|
if (id) {
|
|
var link = $('<a>');
|
|
link.attr('href', '#' + id);
|
|
$item.wrap(link);
|
|
}
|
|
})
|
|
|
|
$('a.toggle').on('click', function(e){
|
|
e.preventDefault();
|
|
console.log('hi');
|
|
var body = $('body');
|
|
if (body.hasClass('toggled')) {
|
|
body.removeClass('toggled');
|
|
} else {
|
|
body.addClass('toggled');
|
|
}
|
|
})
|
|
|
|
var lastScroll = 0;
|
|
var isUp = false;
|
|
var win = $(window);
|
|
|
|
win.on('scroll', function(){
|
|
var scrollTop = win.scrollTop();
|
|
var scrollBottom = win.scrollTop() + win.height();
|
|
var docHeight = $(document).height();
|
|
|
|
if ( scrollTop < 0 || scrollBottom >= docHeight ){
|
|
return;
|
|
}
|
|
|
|
if (scrollTop > (lastScroll + 0) && scrollTop >= 0) {
|
|
if (!isUp) {
|
|
$('a.toggle.show').addClass('hide')
|
|
}
|
|
isUp = true;
|
|
lastScroll = scrollTop;
|
|
} else if (scrollTop < (lastScroll - 0)) {
|
|
if (isUp) {
|
|
$('a.toggle.show').removeClass('hide')
|
|
}
|
|
isUp = false;
|
|
lastScroll = scrollTop;
|
|
}
|
|
});
|
|
|
|
// scroll to the active nav item
|
|
$("nav .scroll").animate({
|
|
scrollTop: $("nav .active").offset().top - 157
|
|
}, 0);
|
|
|
|
// var lastScrollTop = 0;
|
|
// $(window).scroll(function(event){
|
|
// var st = $(this).scrollTop();
|
|
// if (st > lastScrollTop){
|
|
// $('a.toggle.show').addClass('hide')
|
|
// } else {
|
|
// $('a.toggle.show').removeClass('hide')
|
|
// }
|
|
// lastScrollTop = st;
|
|
// });
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-76177358-4', 'auto');
|
|
ga('send', 'pageview');
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|