Skip to content

Commit

Permalink
"created VaporCoin from template https://github.com/vapor/api-template"
Browse files Browse the repository at this point in the history
  • Loading branch information
vkoskiv committed Sep 11, 2017
0 parents commit 449c286
Show file tree
Hide file tree
Showing 23 changed files with 845 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Created by https://www.gitignore.io/api/vapor

### Vapor ###
Config/secrets

### Vapor Patch ###
Packages
.build
xcuserdata
*.xcodeproj
DerivedData/
.DS_Store

# End of https://www.gitignore.io/api/vapor
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
os:
- linux
- osx
language: generic
sudo: required
dist: trusty

osx_image: xcode8.3
before_install:
- if [ $TRAVIS_OS_NAME == "osx" ]; then
brew tap vapor/tap;
brew update;
brew install vapor;
else
eval "$(curl -sL https://apt.vapor.sh)";
sudo apt-get install vapor;
sudo chmod -R a+rx /usr/;
fi

script:
- swift build
- swift build -c release
- swift test

after_success:
- eval "$(curl -sL https://swift.vapor.sh/codecov)"
3 changes: 3 additions & 0 deletions Config/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"foo": "foo-bar"
}
13 changes: 13 additions & 0 deletions Config/crypto.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"hash": {
"method": "sha256",
"encoding": "hex",
"key": "0000000000000000"
},

"cipher": {
"method": "aes256",
"encoding": "base64",
"key": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}
}
43 changes: 43 additions & 0 deletions Config/droplet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"//": "The type of server to use for handling requests.",
"//": "engine: Vapor's blazing fast Engine HTTP server.",
"server": "engine",

"//": "The type of client to use for requesting data from other services.",
"//": "engine: Vapor's blazing fast Engine HTTP client.",
"//": "foundation: A wrapper around Foundation's URLSession.",
"client": "engine",

"//": "The type of console to use for displaying information and prompting input.",
"//": "terminal: Vapor's default terminal console.",
"console": "terminal",

"//": "The type of logger to use for recording logs, warnings, errors, etc.",
"//": "console: Vapor's default logger sends logs directly to the chosen console.",
"log": "console",

"//": "The type of hasher to use for hashing messages.",
"//": "crypto: Vapor's default hasher powered by OpenSSL (configure in crypto.json)",
"//": "bcrypt: Performant BCrypt hashing implementation (configure in bcrypt.json)",
"hash": "crypto",

"//": "The type of cipher to use for encrypting and decrypting messages.",
"//": "crypto: Vapor's default cipher powered by OpenSSL (configure in crypto.json)",
"cipher": "crypto",

"//": "Choose which middleware are enabled (and in which order).",
"//": "error: Catches errors thrown in your application and returns a nice response.",
"//": "date: Adds the 'Date' header to HTTP requests.",
"//": "file: Catches 404 errors and checks for files in the Public/ folder",
"middleware": [
"error",
"date",
"file"
],

"//": "Choose which commands this application can run",
"//": "prepare: Supplied by the Fluent provider. Prepares the database (configure in fluent.json)",
"commands": [
"prepare"
]
}
34 changes: 34 additions & 0 deletions Config/fluent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"//": "The underlying database technology to use.",
"//": "memory: SQLite in-memory DB.",
"//": "sqlite: Persisted SQLite DB (configure with sqlite.json)",
"//": "Other drivers are available through Vapor providers",
"//": "https://github.com/search?q=topic:vapor-provider+topic:database",
"driver": "memory",

"//": "Naming convention to use for creating foreign id keys,",
"//": "e.g., `user_id`",
"//": "`camelCase` option is also available.",
"keyNamingConvention": "snake_case",

"//": "Name of the table Fluent uses to track migrations.",
"//": "If null, preparations will not be run.",
"migrationEntityName": "fluent",

"//": "Character used to join pivot tables, e.g., `user_pet`",
"pivotNameConnector": "_",

"//": "If true, foreign keys will automatically be added",
"//": "to any `builder.foreignId(...)` calls.",
"autoForeignKeys": true,

"//": "Key to specify page number for paginated responses",
"//": "e.g., `?page=2` ",
"defaultPageKey": "page",

"//": "Default page size if not otherwise specified on models",
"defaultPageSize": 10,

"//": "If true, all queries made to the database will be logged.",
"log": false
}
12 changes: 12 additions & 0 deletions Config/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"//": "The $PORT:8080 call tells the json file to see if there",
"//": "is any value at the 'PORT' environment variable.",
"//": "If there is no value there, it will fallback to '8080'",
"port": "$PORT:8080",

"host": "0.0.0.0",

"//": "It's very rare that a server manages its own TLS.",
"//": "More commonly, vapor is served behind a proxy like nginx.",
"securityLayer": "none"
}
120 changes: 120 additions & 0 deletions Package.pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"autoPin": true,
"pins": [
{
"package": "BCrypt",
"reason": null,
"repositoryURL": "https://github.com/vapor/bcrypt.git",
"version": "1.0.0"
},
{
"package": "Bits",
"reason": null,
"repositoryURL": "https://github.com/vapor/bits.git",
"version": "1.0.0"
},
{
"package": "CTLS",
"reason": null,
"repositoryURL": "https://github.com/vapor/ctls.git",
"version": "1.0.0"
},
{
"package": "Console",
"reason": null,
"repositoryURL": "https://github.com/vapor/console.git",
"version": "2.1.0"
},
{
"package": "Core",
"reason": null,
"repositoryURL": "https://github.com/vapor/core.git",
"version": "2.0.2"
},
{
"package": "Crypto",
"reason": null,
"repositoryURL": "https://github.com/vapor/crypto.git",
"version": "2.0.0"
},
{
"package": "Debugging",
"reason": null,
"repositoryURL": "https://github.com/vapor/debugging.git",
"version": "1.0.0"
},
{
"package": "Engine",
"reason": null,
"repositoryURL": "https://github.com/vapor/engine.git",
"version": "2.0.4"
},
{
"package": "Fluent",
"reason": null,
"repositoryURL": "https://github.com/vapor/fluent.git",
"version": "2.1.0"
},
{
"package": "FluentProvider",
"reason": null,
"repositoryURL": "https://github.com/vapor/fluent-provider.git",
"version": "1.1.1"
},
{
"package": "JSON",
"reason": null,
"repositoryURL": "https://github.com/vapor/json.git",
"version": "2.0.2"
},
{
"package": "Multipart",
"reason": null,
"repositoryURL": "https://github.com/vapor/multipart.git",
"version": "2.0.0"
},
{
"package": "Node",
"reason": null,
"repositoryURL": "https://github.com/vapor/node.git",
"version": "2.0.3"
},
{
"package": "Random",
"reason": null,
"repositoryURL": "https://github.com/vapor/random.git",
"version": "1.0.0"
},
{
"package": "Routing",
"reason": null,
"repositoryURL": "https://github.com/vapor/routing.git",
"version": "2.0.0"
},
{
"package": "SQLite",
"reason": null,
"repositoryURL": "https://github.com/vapor/sqlite.git",
"version": "2.0.0"
},
{
"package": "Sockets",
"reason": null,
"repositoryURL": "https://github.com/vapor/sockets.git",
"version": "2.0.1"
},
{
"package": "TLS",
"reason": null,
"repositoryURL": "https://github.com/vapor/tls.git",
"version": "2.0.4"
},
{
"package": "Vapor",
"reason": null,
"repositoryURL": "https://github.com/vapor/vapor.git",
"version": "2.1.0"
}
],
"version": 1
}
21 changes: 21 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import PackageDescription

let package = Package(
name: "VaporCoin",
targets: [
Target(name: "App"),
Target(name: "Run", dependencies: ["App"]),
],
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
.Package(url: "https://github.com/vapor/fluent-provider.git", majorVersion: 1)
],
exclude: [
"Config",
"Database",
"Localization",
"Public",
"Resources",
]
)

Empty file added Public/.gitkeep
Empty file.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<p align="center">
<img src="https://cloud.githubusercontent.com/assets/1342803/24797159/52fb0d88-1b90-11e7-85a5-359fff0496a4.png" width="320" alt="MySQL">
<br>
<br>
<a href="http://beta.docs.vapor.codes/getting-started/hello-world/">
<img src="http://img.shields.io/badge/read_the-docs-92A8D1.svg" alt="Documentation">
</a>
<a href="http://vapor.team">
<img src="http://vapor.team/badge.svg" alt="Slack Team">
</a>
<a href="LICENSE">
<img src="http://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT License">
</a>
<a href="https://circleci.com/gh/vapor/mysql">
<img src="https://circleci.com/gh/vapor/mysql.svg?style=shield" alt="Continuous Integration">
</a>
<a href="https://travis-ci.org/vapor/api-template">
<img src="https://travis-ci.org/vapor/api-template.svg?branch=master" alt="Build Status">
</a>
<a href="https://swift.org">
<img src="http://img.shields.io/badge/swift-3.1-brightgreen.svg" alt="Swift 3.1">
</a>
</center>
23 changes: 23 additions & 0 deletions Sources/App/Config+Setup.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import FluentProvider

extension Config {
public func setup() throws {
// allow fuzzy conversions for these types
// (add your own types here)
Node.fuzzy = [Row.self, JSON.self, Node.self]

try setupProviders()
try setupPreparations()
}

/// Configure providers
private func setupProviders() throws {
try addProvider(FluentProvider.Provider.self)
}

/// Add all models that should have their
/// schemas prepared before the app boots
private func setupPreparations() throws {
preparations.append(Post.self)
}
}
Loading

0 comments on commit 449c286

Please sign in to comment.