Questions tagged [server-side-swift]
79 questions
2
votes
1 answer
How to read a parameter in a Vapor middleware without consuming it
I am brand new to the Vapor framework, and am trying to protect multiple routes. Basically, I want to make sure that all routes under /campaigns/:id can only be accessed if the user actually has access to that particular campaign with that ID. So…

Kevin Renskers
- 5,156
- 4
- 47
- 95
2
votes
2 answers
Access a service from a Job in Vapor 3
I'm very new to Vapor and server-side swift, with a background in iOS development (6 years developing apps). I'm trying to build a simple API for device management which amongst other things includes a "job" (Timer whatever you want to call it)…

simonthumper
- 1,834
- 2
- 22
- 44
2
votes
1 answer
Creating data in SQLite database manually in Vapor
How to add data to SQLite database manually in Vapor project so that at startup there's already some data in it?

jonaszmclaren
- 2,459
- 20
- 30
2
votes
1 answer
Vapor Deployment -> ERROR: Repository not found
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: deploy failed.

Biut Thapa
- 21
- 4
2
votes
1 answer
Filter data From vapor client get
i'm using vapor's client to fetch a get request.
func sendGetRequest(req: Request) throws -> Future {
let client = try req.make(FoundationClient.self)
return client.get("http://example.vapor.codes/json", headers: ["Accept-Language"…

Tarek hemdan
- 874
- 2
- 10
- 24
2
votes
1 answer
How to set StaticFileServer() using Kitura?
I want to see files in my localhost directory using Kitura.
I've written:
router.all("/test/*", middleware: StaticFileServer())
but it didn't seem to work
I want to all files in my directory. Similar to directoryIndex

denis631
- 1,765
- 3
- 17
- 38
2
votes
1 answer
Vapor 2, One to Many relation
Do you have any example of how to create One to Many relation using Vapor 2?
There are some examples of how to do this, but they use the old version of Vapor.
Thank you for all suggestions.

jonaszmclaren
- 2,459
- 20
- 30
2
votes
2 answers
how to run swift server single process
I'm trying to run a swift based web server using Kitura on Ubuntu.
This is following command to start hello word server.
.build/debug/helloworld
I can launch standalone process using .build/debug/helloworld &
but launching with that creates multiple…

Bhupendra Singh
- 121
- 1
- 6
1
vote
1 answer
how do vapor fluent do a upsert?
I have a table named profile, and my model here:
final class Profile: Model, Content {
struct Keys {
static let userId: FieldKey = "user_id"
static let nickname: FieldKey = "nickname"
static let bio: FieldKey = "bio"
…

yxk
- 11
- 2
1
vote
1 answer
How to add a class to the body tag in a Leaf base template
I'm building a site with Vapor and using the Leaf templating engine. Say I have the following base template defined in Base.leaf:
#(title)

Jake Strickler
- 364
- 2
- 11
1
vote
1 answer
Sign in with Apple using Vapor 4
I'm trying to implement Sign In with Apple using Vapor 4
I followed Vapor Docs
But when I use the api and send user's token (even as a request header or in the body), it returns the following error
{
"error": true,
"reason": "Data corrupted…

khawlah
- 23
- 4
1
vote
0 answers
Vapor: How to get response URL using Vapor Client or async-http
Something I'm running into when using Vapor to crawl sites is if I enter a url like http://website(dot)com and it redirects to https://www.website(dot)com, I need to grab that final response URL to know what the final page URL is.
I can do this with…

Graham
- 19
- 2
1
vote
1 answer
Vapor App Local setup using Docker Compose
I used docker-compose for setting on my local machine.
Vapor app is working fine without using docker.
Environment
MacBook M1 Pro 14inch 2021
32GB Ram
But I got an error at Step 3
(Step 1, and 2 are ok, Swift compiler builds Vapor app…

Shawn Baek
- 1,928
- 3
- 20
- 34
1
vote
2 answers
Swift Vapor index.html is not recognised by server as default
Hi I am using vapor for server side with swift programming language. For file serving I correctly configured the middleware in xcode. But index.html in the folder is not recognisable by server itself. But calling specific file…
user19263191
1
vote
2 answers
Is it possible to work with different schemas in Fluent with PostgreSQL?
I need to create tables with different number of fields for different users. I want to create a schema for each user, and in it a custom set of tables. I can do this with direct database queries. This will create a categories table in the schema…

Victor
- 13
- 4