Giter VIP home page Giter VIP logo

api-template's Introduction

Vapor

Documentation Team Chat MIT License Continuous Integration Code Coverage Swift 5.7+ Mastodon


Vapor is an HTTP web framework for Swift. It provides a beautifully expressive and easy-to-use foundation for your next website, API, or cloud project.

Take a look at some of the awesome stuff created with Vapor.

💧 Community

Join the welcoming community of fellow Vapor developers on Discord.

🚀 Contributing

To contribute a feature or idea to Vapor, create an issue explaining your idea or bring it up on Discord.

If you find a bug, please create an issue.

If you find a security vulnerability, please contact [email protected] as soon as possible.

💛 Sponsors

Support Vapor's development by becoming a sponsor.

Broken Hands Emerge Tools Jari Donut Dane MacStadium

💚 Backers

Support Vapor's development by becoming a backer.

Moritz LangMaarten EngelsThomas KrajacicJesse TiptonSteve HumeMikkel UlstrupGeoffrey FosterPaul SchmiedmayerScott RobbinsSven A. SchmidtSpencer CurtisZach RausnitzTim „Timinator“ KretzschmarKlaasAndrew Edwards+Li, Inc.Stijn WillemsKyle NewsomeVia Aurelia SolutionsJakub KiermaszBrian DrellingMattes MohrJamieGalen RhodesLitmapsDavid RomanBrian StrobachKishikawa KatsumiAlex SherbakovSidetrackGreg KarpatiFrantišek MikšJeremy GreenwoodRay FixMićo MiloložaAlanJonas SannewaldTapEnvy.us, LLCJawadPARAIPAN SORINKalyn DavisYR ChenAarón Martínez Cuevas

api-template's People

Contributors

0xtim avatar 4np avatar barbosa avatar bygri avatar casperhr avatar cellane avatar dankorotin avatar eneko avatar epologee avatar gperdomor avatar hortontp avatar jamieedge avatar jchannon avatar joannis avatar joscdk avatar kdawgwilk avatar ketzusaka avatar kevinvitale avatar kimar avatar loganwright avatar mikekavouras avatar mrlotu avatar nathanflurry avatar revolter avatar rosslebeau avatar saicu avatar shnhrrsn avatar tanner0101 avatar vzsg avatar yasumoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-template's Issues

Travis fails to build on linux

I'm trying to make Travis-CI work with project created from this template (.travis.yml is not changed).
Travis works fine with osx, but fails on linux:

Worker information
hostname: travis-worker-gce-com-prod-1:f04b470b-fcb3-4aad-a229-f4a9b2666fd2
version: v2.6.2 https://github.com/travis-ci/worker/tree/fdccca4efd347ebc889baae641ccbf55bb871d19
instance: testing-gce-c32bd5c8-a6e4-4d76-bec5-001b6891a993:travis-ci-connie-trusty-1480957854
startup: 21.157565003s
Build system information
Build language: generic
Build group: stable
Build dist: trusty
Build id: 39350495
Job id: 64169159
travis-build version: 57a431e31
Build image provisioning date and time
Mon Dec  5 17:21:29 UTC 2016
Operating System Details
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.5 LTS
Release:	14.04
Codename:	trusty
Linux Version
4.4.0-51-generic
Cookbooks Version
998099c https://github.com/travis-ci/travis-cookbooks/tree/998099c
git version
git version 2.11.0
bash version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gcc version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

docker version
Client:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 21:44:32 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 21:44:32 2016
 OS/Arch:      linux/amd64
clang version
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
jq version
jq-1.5
bats version
Bats 0.4.0
gimme version
v1.0.0
nvm version
0.32.0
perlbrew version
/home/travis/perl5/perlbrew/bin/perlbrew  - App::perlbrew/0.78
postgresql client version
psql (PostgreSQL) 9.3.15
rvm version
rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
default ruby version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Pre-installed Ruby versions
ruby-2.2.5
ruby-2.3.1

$ export DEBIAN_FRONTEND=noninteractive
Reading package lists...
Building dependency tree...
Reading state information...
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 87 not upgraded.

Installing an SSH key from: default repository key
Key fingerprint: <...>

$ git clone --depth=50 --branch=master [email protected]:<...> <...>
Cloning into '<...>'...
Warning: Permanently added the RSA host key for IP address '<...>' to the list of known hosts.
remote: Counting objects: 62, done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 62 (delta 8), reused 58 (delta 5), pack-reused 0
Receiving objects: 100% (62/62), 44.57 KiB | 0 bytes/s, done.
Resolving deltas: 100% (8/8), done.

$ cd <...>
$ git checkout -qf 6dbee088946e81a3b551e8444f9246da3ea006be
$ bash -c 'echo $BASH_VERSION'
4.3.11(1)-release
$ eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"
Cloning into '/home/travis/.swiftenv'...
remote: Counting objects: 81, done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 81 (delta 4), reused 44 (delta 3), pack-reused 0
Unpacking objects: 100% (81/81), done.

$ swift build
The program 'swift' is currently not installed. To run 'swift' please ask your administrator to install the package 'python-swiftclient'


The command "swift build" exited with 127.
$ swift build -c release
The program 'swift' is currently not installed. To run 'swift' please ask your administrator to install the package 'python-swiftclient'


The command "swift build -c release" exited with 127.

Done. Your build exited with 1.

Tests Folder

I think it would be a good idea to encourage best practices by including a Tests folder in the Vapor project template.

Add tags for SPM

This is a bit of an edge case, but I have a project that wants to import this template, so that it always has an up-to-date "Hello World" for Vapor. Currently I'm bringing it in like this, which just feels... wrong:

.package(url: "https://github.com/vapor/api-template.git", from: "0.0.0"),

It could be helpful to have tags anyway, so users can continue to build new projects in Vapor 3 when 4 is out, etc. 👌

Template doesn't work with Vapor 4 RC

Hello,

The template doesn't seem to work with vapor 4 RC.

The error I get is when calling the "/todo" url: Fatal error: @ID requires UUID, use @ID(custom:) for Int..

Here's the file that should be fixed: https://github.com/vapor/api-template/blob/4/Sources/App/Models/Todo.swift
According to the documentation, I believe it should be @ID(key: .id) , and ID should be of UUID type
I don't need support on this as I figured it out myself.

CreateTodo should also create an UUID table

I'd open a PR but I'm not sure that this is the right fix. If you want me to do it, I'd be happy to.

Update to Vapor 4

I just created a project with this template (with vapor new <name> --template=api) and I saw it was not using Vapor 4, but Vapor 3.

Also, I am trying to use it with another package which uses a newer version of Swift NIO (used in Vapor 4, but not Vapor 3) so I have dependencies conflicts.

Any plan to update this template (and also other templates by the way) to Vapor 4?

Suggestion - remove global methods

I think we should stop using global methods in app.swift, boot.swift, configure.swift, and routes.swift as it goes against the Swift style guide. I suggest instead using static methods of a singleton, as one possible alternative.

Remove Unnecessary Code from Template

Related to the discussion for this PR: #61 (comment)

This idea is a bit more radical, but I think we should remove everything that will not be used in every project, except for maybe a default index page. This is a template, not an example project.

To that point, we would get rid of:

  • All models
  • SQLite database configurations and package
  • all routes (maybe have an default root route that can be hit, but make it small)

I understand the point of the VC and CI configs, so that could be left alone.

Example projects have their place, but for those of us who have been doing Vapor for a while, we don't want to have to delete a bunch of example code every time we create a new project.

Adding a relationship

Template should be expanded with some kind of relationship. Either User->Posts, or Post->Comments, so as to explain how to handle this.

Documentation currently isn't very clear, and I didn't manage to get help on Slack either, so it seems others are struggling about this too.
This would also explain best practice, and how to use Children<,> foreignId() and so on.

Tests fails using MySQL Provider

In this function:

    func testPostRoutes() throws {
        let idOne = try create() ?? -1
        try fetchOne(id: idOne)
        try fetchAll(expectCount: 1)
        try patch(id: idOne)
        try put(id: idOne) // HERE

        let idTwo = try create() ?? -1
        try fetchAll(expectCount: 2)

        try deleteOne(id: idOne)
        try fetchAll(expectCount: 1)

        try deleteOne(id: idTwo)
        try fetchAll(expectCount: 0)

        let newIds = try (1...5).map { _ in try create() ?? 1 }
        try fetchAll(expectCount: newIds.count)
        try deleteAll()
        try fetchAll(expectCount: 0)
    }

When try put(id: idOne) is called, delete the initial post and create a new post, so the original idOne not exists anymore and fails here try deleteOne(id: idOne)

Fails using mysql, i don't know why pass using memory driver

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.