Skip to content

Commit cb6bcf5

Browse files
committed
Merge branch 'develop' into main
2 parents 63e2da9 + c56dc3e commit cb6bcf5

File tree

18 files changed

+359
-104
lines changed

18 files changed

+359
-104
lines changed

.github/workflows/swift.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
- cron: "55 9 * * 1"
7+
- cron: "38 9 * * 1"
88

99
jobs:
1010
linux:

.travis.d/before-install.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

.travis.d/install.sh

Lines changed: 0 additions & 37 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

Package.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ let package = Package(
1111
],
1212

1313
products: [
14-
.executable(name: "httpd-helloworld", targets: [ "httpd-helloworld" ]),
15-
.executable(name: "connect-static", targets: [ "connect-static" ]),
16-
.executable(name: "express-simple", targets: [ "express-simple" ]),
17-
.executable(name : "express-simple-lambda",
14+
.executable(name: "httpd-helloworld", targets: [ "httpd-helloworld" ]),
15+
.executable(name: "connect-static", targets: [ "connect-static" ]),
16+
.executable(name: "express-simple", targets: [ "express-simple" ]),
17+
.executable(name: "todomvc", targets: [ "todomvc" ]),
18+
.executable(name : "express-simple-lambda",
1819
targets : [ "express-simple-lambda" ])
1920
],
2021

2122
dependencies: [
2223
// A lot of packages for demonstration purposes, only add what you
2324
// actually need in your own project.
2425
.package(url: "https://github.com/Macro-swift/Macro.git",
25-
from: "0.6.2"),
26+
from: "0.8.7"),
2627
.package(url: "https://github.com/Macro-swift/MacroExpress.git",
27-
from: "0.6.1"),
28+
from: "0.8.4"),
2829
.package(url: "https://github.com/Macro-swift/MacroLambda.git",
2930
from: "0.2.1"),
3031
.package(url: "https://github.com/AlwaysRightInstitute/cows",
@@ -35,7 +36,8 @@ let package = Package(
3536
.target(name: "httpd-helloworld", dependencies: [ "Macro" ]),
3637
.target(name: "connect-static", dependencies: [ "MacroExpress" ]),
3738
.target(name: "express-simple", dependencies: [ "MacroExpress", "cows" ]),
38-
39+
.target(name: "todomvc", dependencies: [ "MacroExpress" ]),
40+
3941
.target(name: "express-simple-lambda",
4042
dependencies: [ "MacroLambda", "cows" ])
4143
]

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ This repository contains examples for
1313

1414
### Running Examples as Scripts
1515

16-
Examples can be run as scripts using [swift-sh](https://github.com/mxcl/swift-sh)
17-
(can be installed using a simple `brew install mxcl/made/swift-sh`).
16+
Single file examples can be either run as scripts using
17+
[swift-sh](https://github.com/mxcl/swift-sh)
18+
(install using a simple `brew install mxcl/made/swift-sh`),
19+
from within Xcode or via `swift run`.
1820

1921
This also contains an example for deploying to AWS Lambda:
2022
[express-simple-lambda](Sources/express-simple-lambda/).
2123

24+
2225
## Examples
2326

24-
### httpd-helloworld
27+
### [httpd-helloworld](Sources/httpd-helloworld)
2528

2629
Raw HTTP server w/o Express extras (middleware, templates).
2730

@@ -34,7 +37,7 @@ Single source file:
3437
```swift
3538
#!/usr/bin/swift sh
3639

37-
import Macro // @Macro-swift ~> 0.0.12
40+
import Macro // @Macro-swift
3841

3942
http.createServer { req, res in
4043
// log request
@@ -60,7 +63,7 @@ http.createServer { req, res in
6063
}
6164
```
6265

63-
### express-simple
66+
### [express-simple](Sources/express-simple)
6467

6568
```bash
6669
$ Sources/express-simple/main.swift
@@ -75,8 +78,8 @@ Forms, cookies, JSON, sessions, templates and cows - you get it all!
7578
```swift
7679
#!/usr/bin/swift sh
7780

78-
import MacroExpress // @Macro-swift ~> 0.0.4
79-
import cows // @AlwaysRightInstitute ~> 1.0.0
81+
import MacroExpress // @Macro-swift
82+
import cows // @AlwaysRightInstitute
8083

8184
let app = express()
8285

@@ -148,7 +151,7 @@ Looks like this:
148151
There is an AWS Lambda variant of this (with minor adjustments):
149152
[express-simple-lambda](Sources/express-simple-lambda/).
150153

151-
### connect-simple
154+
### [connect-simple](Sources/connect-simple)
152155

153156
Use the simpler `connect` module, instead of `express`.
154157
Probably no need to do this in the real world, just use MacroExpress.
@@ -160,6 +163,15 @@ $ Sources/express-simple/main.swift
160163
2020-06-03T14:58:59+0200 notice: Server listening on http://localhost:1337
161164
```
162165

166+
### [todomvc](Sources/todomvc/)
167+
168+
A MacroExpress implementation of a [Todo-Backend](http://todobackend.com/),
169+
a simple JSON API to access and modify a list of todos.
170+
171+
```bash
172+
$ swift run todomvc
173+
2020-06-03T14:58:59+0200 notice: Server listening on http://localhost:1337
174+
```
163175

164176

165177
## Who

Sources/connect-static/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h2>Macro.swift connect-static
2-
<img src="http://zeezide.com/img/MicroExpressIcon1024.png"
3-
align="right" width="100" height="100" />
2+
<img src="http://zeezide.com/img/macro/MacroExpressIcon128.png"
3+
align="right" width="100" height="100" />
44
</h2>
55

66
Demonstrates the use of the `connect.serveStatic` middleware.

Sources/connect-static/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/swift sh
22

3-
import MacroExpress // @Macro-swift ~> 0.5.4
3+
import MacroExpress // @Macro-swift
44

55
let dirname = __dirname()
66

Sources/express-simple-lambda/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/swift sh
22

3-
import MacroLambda // @Macro-swift ~> 0.1.1
4-
import cows // @AlwaysRightInstitute ~> 1.0.0
3+
import MacroLambda // @Macro-swift
4+
import cows // @AlwaysRightInstitute
55

66
let app = express()
77

Sources/express-simple/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/swift sh
22

3-
import MacroExpress // @Macro-swift ~> 0.5.4
4-
import cows // @AlwaysRightInstitute ~> 1.0.0
3+
import MacroExpress // @Macro-swift
4+
import cows // @AlwaysRightInstitute
55

66
let app = express()
77

0 commit comments

Comments
 (0)