Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 2.63 KB

buildrun.md

File metadata and controls

60 lines (40 loc) · 2.63 KB

Building and running your Express app

This section is dedicated to different types and flavors of building and running Express apps. Differences between Linux and OS X systems are outlined explicitly.

Building with Express Command Line

At the moment of writing Express Command Line tools are available for OS X only, but soon to be ported to Linux as well. Stay tuned.

Express Command Line is the easiest way to work with Express apps. The building and running is as straightforward as:

swift-express build
swift-express run

For the full set of available parameters, please, refer to the main documentation page.

Building manually with Swift Package Manager

Swift Package Manager is the default way of building Swift apps. Most probably soon to be supported in xCode out of the box as well. If you don't want to use Express Command Line for some reason, here is how to build an express app manually.

Development build

In development, it's generally not a good idea to build the app with Dispatch support on Linux as it becomes non-debuggable with lldb. To build an Express app without Dispatch run the following in terminal:

swift build --fetch
#swift build does not work with tests properly yet
rm -rf Packages/*/Tests
swift build

Now you can run your app with:

# note, that if you use port 80 you might need to do it with sudo
./.build/debug/YOUR_APP_NAME

Production build

Express apps show a level of magnitude better performance when built with dispatch support. If you are using Linux, before continuing make sure you followed Dispatch installation section.

Here is how to build your app for production:

swift build --fetch
#swift build does not work with tests properly yet
rm -rf Packages/*/Tests
swift build -c release -Xcc -fblocks -Xswiftc -Ddispatch

Now you can run your app in production with:

# note, that if you use port 80 you might need to do it with sudo
./.build/release/YOUR_APP_NAME

Next tutorial: Basic Routing