Coder Social home page Coder Social logo

ibm / swift-backend-for-frontend Goto Github PK

View Code? Open in Web Editor NEW
7.0 21.0 5.0 1.25 MB

WARNING: This repository is no longer maintained ⚠️ This repository will not be updated.

Home Page: https://cloud.ibm.com/developer/appservice/starter-kits/swift-bff-example-with-kitura

License: Apache License 2.0

Shell 0.19% Dockerfile 0.03% Swift 0.34% HTML 5.14% JavaScript 94.18% HCL 0.11%
ibmcode ibm-cloud bff frontend swift backend kitura

swift-backend-for-frontend's Introduction

WARNING: This repository is no longer maintained ⚠️

This repository will not be updated. The repository will be kept available in read-only mode.

Platform

Create and deploy a Swift Backend For Frontend (BFF) using Kitura

We have similar patterns available for Node.js, Java Spring, and Java Liberty as well!

In this code pattern, you will create a Backend for Frontend (BFF) web service using Kitura in Swift, matching a RESTful API documented in Swagger.

A BFF can be used to elegantly expose complex backend systems to multiple client-facing platforms, such as iOS and the web, without building a monolothic API that attempts to serve all clients equally. Different types of clients require different types of user experiences, and having a backend API tightly coupled to each specific user experience actually makes for a much more loosely coupled system overall. This pattern helps frontend teams iterate on features faster by giving them more control over the APIs they interact with, without affecting the user experience or development team driving a sister frontend.

When you have completed this code pattern, you will understand how to:

  • Build out the Backend for Frontend (BFF) architecture pattern
  • Deploy to Kubernetes, Cloud Foundry or a DevOps Pipeline
  • Operate an application with monitoring and distributed trace
  • Connect to provisioned services

Video

Learn more about the Backend for Frontend pattern in this tech talk:

BFFs and GraphQL, terms you should know and why

Steps

As an alternative to the steps below, you can create this project as a starter kit on IBM Cloud, which automatically provisions required services, and injects service credentials into a custom fork of this pattern. Then, you can skip directly to step 3 below.

  1. Install development tools
  2. Configuration
  3. Run

1. Install development tools

Local Development Tools Setup

IBM Cloud development tools setup

  1. Install IBM Cloud Developer Tools on your machine
  2. Install the plugin with: ibmcloud plugin install dev -r "IBM Cloud"

2. Configuration

Your application configuration information is stored in config.json. If you selected services added to your project, you will see Cloudant, Object Storage, and other services with their connection information such as username, password, and hostname listed here. This is useful for connecting to remote services while running your application locally.

When you push your application to IBM Cloud, however, these values are no longer used, and instead IBM Cloud automatically connects to those bound services through the use of environment variables. The config.json file has been added to the .gitignore file so you don't accidently check in the secret credentials.

3. Run

Using IBM Cloud development CLI

The IBM Cloud development plugin makes it easy to compile and run your application if you do not have all of the tools installed on your computer yet. Your application will be compiled with Docker containers. To compile and run your app, run:

ibmcloud dev build
ibmcloud dev run

Using your local development environment

Once the Swift toolchain has been installed, you can compile a Swift project with:

swift build

Your sources will be compiled to your .build/debug directory.

Endpoints

Your application is running at: http://localhost:8080/ in your browser.

  • Your Swagger UI is running on: /explorer
  • Your Swagger definition is running on: /swagger/api

Troubleshooting

Using IBM Cloud development CLI, build and debug your app using:

ibmcloud dev build --debug
ibmcloud dev debug

License

This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 and the Apache License, Version 2.

Apache License FAQ

swift-backend-for-frontend's People

Contributors

dolph avatar ibm-devx-automation avatar imgbotapp avatar stevemar avatar stevemart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.