An open API service indexing awesome lists of open source software.

https://github.com/vaporexampleslab/quickstart-bootstrap-basic

Minimal Vapor Bootstrap example project.
https://github.com/vaporexampleslab/quickstart-bootstrap-basic

server-side-swift vapor vapor-3 vapor-example

Last synced: 4 months ago
JSON representation

Minimal Vapor Bootstrap example project.

Awesome Lists containing this project

README

          

# [quickstart-bootstrap-basic][t]
[t]:https://github.com/VaporExamplesLab/quickstart-bootstrap-basic



Documentation


MIT License


Swift 4.2


[Getting Started](#GettingStarted) •
[Original Setup](#OriginalSetup) •
[Resources](#Resources)

## Getting Started [▴](#toc)

**Prerequisites**

* [Install Xcode 10 ⇗](https://itunes.apple.com/us/app/xcode/id497799835?mt=12)
* [Install homebrew ⇗](https://brew.sh/)
* [Install vapor toolbox ⇗](https://docs.vapor.codes/3.0/install/macos/)

**Download|Clone & Run**

Steps to download repository:

``` bash
## go to your working directory
cd

## download and unzip
wget https://github.com/VaporExamplesLab/quickstart-bootstrap-basic/archive/master.zip
unzip master.zip -d quickstart-bootstrap-basic
rm master.zip # remove download

cd quickstart-bootstrap-basic-master

# update dependencies
# with `-y` yes to generate and open Xcode project
vapor update -y
```

Or, alternate steps to clone repository instead of download:

``` bash
## go to your working directory
cd

## either clone
## add --bare option for an unattached instance
git clone git@github.com:VaporExamplesLab/quickstart-bootstrap-basic.git

cd quickstart-bootstrap-basic

# update dependencies
# with `-y` yes to generate and open Xcode project
vapor update -y
```

Set Xcode scheme to "Run > My Mac".

![](README_files/XcodeScheme.png)

Click the run button and check the results in a browser at `http://localhost:8080`.

![](README_files/LandingPage.png)

## Original Setup [▴](#toc)

The following steps were completed to create the `quickstart-bootstrap-basic` example.

**Create Vapor Website Project**

Create a `quickstart-bootstrap-basic` project from the command line terminal:

``` bash
vapor new quickstart-bootstrap-basic --web
cd quickstart-bootstrap-basic
# add directory for README.md assets
mkdir README_files
touch README_files/.git_keep # create file so folder is not empty for `git`

# update dependencies
# with `-y` yes to generate and open Xcode project
vapor update -y
```

**Add Bootstrap**

Use the Bootstrap starter template. On [getbootstrap.com](getbootstrap.com) click the _`Get started`_ button and scroll down to _`Starter template`_ section. The ``, `` and `` are added to Resources/View/base.leaf in the Vapor project. The `#get(body)` is placed inside a Bootstrap container `<div>`

_base.leaf_

``` html
<!doctype html>
<html lang="en">
<head>
<!-- Bootstrap required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- Application overriding CSS -->
<link rel="stylesheet" href="/styles/app.css">

<title>#get(title)</title>
</head>
<body>
<!-- navigation to go here. -->

<!-- mt-3: margin top `1rem` -->
<div class="container mt-3">
#get(body)
</div>

<!-- JavaScript to support various Bootstrap features -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">