# Server Side Swift with Vapor - Part 2: Hello World | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425>\
**Category:** 🎓 Courses & Articles\
**Created:** [February 13, 2018, 3:52pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425 "2018-02-13T15:52:46Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![doyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/doyle/32/102075_2.png) [@doyle](https://forums.kodeco.com/u/doyle)\
**Post date:** [March 5, 2018, 5:59am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/62 "2018-03-05T05:59:55Z")

</div>

Edit: I have a feeling I’m doing something wrong, I keep redoing the tutorial and getting new errors. I’ll try work out what I’m doing wrong sorry.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 5, 2018, 7:08am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/63 "2018-03-05T07:08:57Z")

</div>

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![doyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/doyle/32/102075_2.png) [@doyle](https://forums.kodeco.com/u/doyle)\
**Post date:** [March 5, 2018, 7:24am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/64 "2018-03-05T07:24:10Z")

</div>

Yes sorry, all sorted and got it working now, I just confused myself with the “HelloVapor” project and “hello” page. Should have watched to the end of the vid first.

---

<div class="post-metadata">

**Author:** ![youareapp](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/youareapp/32/81494_2.png) [@youareapp](https://forums.kodeco.com/u/youareapp)\
**Post date:** [March 6, 2018, 3:04pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/65 "2018-03-06T15:04:12Z")

</div>

Can I build my Vapor 3 project on Ubuntu ECS ?

---

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [March 6, 2018, 6:54pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/66 "2018-03-06T18:54:29Z")

</div>

I couldn’t make it work in a browser until I tried the solution found in this thread:

```
services.register { _ in 
  EngineServerConfig.detect(hostname: "127.0.0.1", port: 8080) 
}

```

Now it works with this port. Can anyone help me figure out what’s wrong and why localhost:8080 doesn’t work?

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 7, 2018, 12:20am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/67 "2018-03-07T00:20:01Z")

</div>

@dricard have you got anything weird in your `/etc/hosts` file?

---

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [March 7, 2018, 1:48am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/68 "2018-03-07T01:48:48Z")

</div>

I’m sure I don’t know what’s supposed to be in there. Here what’s in it.

```
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1 localhost

```

Anything wrong with that?

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 7, 2018, 2:18pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/69 "2018-03-07T14:18:36Z")

</div>

@dricard bizarre! That looks completely valid 🤔

If you run `ping localhost` in terminal does it work? If you remove the solution you added and try running your application what gets printed in the console?

---

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [March 7, 2018, 4:37pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/70 "2018-03-07T16:37:10Z")

</div>

Yes if I ping localhost it works. When I remove the solution and I run this is what I get in the console:

```auto
Migrating sqlite DB
Migrations complete
Server starting on http://localhost:8080

```

And when I load [http://localhost:8080/hello](http://localhost:8080/hello) I get this in Safari:

 ![03 AM](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/3X/7/2/721b0c164bc68a17a4e45e21f0adb405608250c2.png)

It does the same in Firefox:

 ![04 AM](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/3X/6/4/640f32db9f356f6d19f1c6ee6102fa4d60537360.png)

With the solution:

```auto
Migrating sqlite DB
Migrations complete
Server starting on http://127.0.0.1:8080

```

And loading `http://127.0.0.1:8080/hello` in Safari works (I get ‘Hello World’).

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 7, 2018, 5:16pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/71 "2018-03-07T17:16:28Z")

</div>

That is bizarre! Does a `curl -v http://localhost:8080/hello` work at all?

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 7, 2018, 5:50pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/72 "2018-03-07T17:50:01Z")

</div>

Speaking to some others it may be an IPv6 issue - this should be fixed by the integration of Swift NIO soon

---

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [March 7, 2018, 5:56pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/73 "2018-03-07T17:56:07Z")

</div>

This is what I get from the curl:

```auto
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /hello HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

```

Trying with the solution returns this instead:

```auto
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /hello HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Length: 13
< Content-Type: text/plain; charset=utf-8
< Date: Wed, 07 Mar 2018 17:55:05 GMT
<
* Connection #0 to host 127.0.0.1 left intact
Hello, world!

```

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 7, 2018, 7:00pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/74 "2018-03-07T19:00:07Z")

</div>

@dricard ok so it’s definitely preferring IPv6 over IPv4 - looks like there’s an issue around packets/streams for IPv6. The good news is this should be fixed pretty soon. As for why it is happening - if you add another line at the bottom of your `/etc/hosts` for `127.0.0.1	localhost` to see if it picks that over IPv6 address - or wait for the fix with your workaround til then!

---

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [March 8, 2018, 8:08pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/75 "2018-03-08T20:08:02Z")

</div>

@0xtim thanks for looking into this for me! I guess I’ll keep the workaround until this is resolved. Where should I look for info on a possible fix?

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 8, 2018, 8:27pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/76 "2018-03-08T20:27:46Z")

</div>

@dricard either the Vapor Slack or GitHub releases. I’ll ping you when NIO hits though anyway

---

<div class="post-metadata">

**Author:** ![lac\_ekim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lac_ekim/32/102075_2.png) [@lac\_ekim](https://forums.kodeco.com/u/lac_ekim)\
**Post date:** [March 18, 2018, 5:09am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/77 "2018-03-18T05:09:03Z")

</div>

@0xtim hello bud…im running into a issue. everything is installed, Xcode toolchains is switched but it will not allow me to run the “vapor new HelloVapor --branch=beta”.

---

<div class="post-metadata">

**Author:** ![fahim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fahim/32/110943_2.png) [@fahim](https://forums.kodeco.com/u/fahim)\
**Post date:** [March 18, 2018, 5:28am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/78 "2018-03-18T05:28:09Z")

</div>

> [@lac\_ekim](#):
>
> @0xtim hello bud…im running into a issue. everything is installed, Xcode toolchains is switched but it will not allow me to run the “vapor new HelloVapor --branch=beta”.

What is the error message you get? Knowing the error message could be useful in figuring out what is going on …

---

<div class="post-metadata">

**Author:** ![lac\_ekim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lac_ekim/32/102075_2.png) [@lac\_ekim](https://forums.kodeco.com/u/lac_ekim)\
**Post date:** [March 18, 2018, 6:11am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/79 "2018-03-18T06:11:42Z")

</div>

got it working bud, TY though!

---

<div class="post-metadata">

**Author:** ![midtownkc](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/midtownkc/32/74685_2.png) [@midtownkc](https://forums.kodeco.com/u/midtownkc)\
**Post date:** [March 29, 2018, 6:21pm UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/80 "2018-03-29T18:21:00Z")

</div>

I’ve got 4.1 installed and vapor, however I can’t get the web server to launch. I’ve deleted and recreated the app several times. I get the following error:

[INFO] Migrating ‘sqlite’ database (FluentProvider.swift:28)  
[INFO] Preparing migration ‘Todo’ (MigrationContainer.swift:50)  
⚠ [FluentError.reflectProperty: No property reflected for Swift.WritableKeyPath\<App.Todo, Swift.Optional\<Swift.Int\>\>] [/Users/maxfred/code/swift/vapor/HelloVapor/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migration.swift:28:124]  
Program ended with exit code: 1

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [March 30, 2018, 10:23am UTC](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425/81 "2018-03-30T10:23:18Z")

</div>

@midtownkc run `vapor update` there was a broken reflection API in Core that for some reason still is being used by the template - I’ll get that updated

[Previous page](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425.md?page=3)

[Next page](https://forums.kodeco.com/t/server-side-swift-with-vapor-part-2-hello-world-ray-wenderlich/39425.md?page=5)
