GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - PerfectExamples/Perfect-JSON-API: An Example JSON API for Perfect

BranchesTags
Open more actions menu

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
Sources
Sources
 
 
Tests
Tests
 
 
.gitignore
.gitignore
 
 
Example-PeopleAPI.postman_collection
Example-PeopleAPI.postman_collection
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
README.zh_CN.md
README.zh_CN.md
 
 

Repository files navigation

Perfect JSON API Example 简体中文

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 3.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

An Example JSON API for Perfect

This package builds with Swift Package Manager and is part of the Perfect project.

Ensure you have installed Xcode 8.0 or later.

Setup - Xcode 8

  • Check out or download the project;
  • In terminal, navigate to the directory and execute
swift package generate-xcodeproj
  • Open Perfect-JSON-API.xcodeproj
  • Add to the "Library Search Paths" in "Project Settings" $(PROJECT_DIR), recursive. (This step will be unneeded in a future release of Xcode 8.)
  • Select the Executable build target from the build targets dropdown in Xcode
  • Run (cmd-R) to build & run in Xcode.

In Xcode's console output pane you will see:

[INFO] Starting HTTP server on 0.0.0.0:8181 with document root ./webroot
  • In a browser, visit http://localhost:8181/api/v1/people

Setup - Terminal

  • Check out or download the project;
  • In terminal, navigate to the directory
  • Execute swift build
  • Once the project has compiled, execute ./.build/debug/Perfect-JSON-API

The output you will see:

[INFO] Starting HTTP server on 0.0.0.0:8181 with document root ./webroot
  • In a browser, visit http://localhost:8181/api/v1/people

Included Routes

The following routes are included in this API for demonstration purposes:

  • GET: http://localhost:8181/ - A demonstration HTML "Hello, world!" page is returned.
  • GET: http://localhost:8181/api/v1/people - Returns a JSON list of persons from the included mock data.
  • POST: http://localhost:8181/api/v1/people - Adds a person to the internal mock object and returns the new array as JSON. Note the following POST params are expected: firstName, lastName, email.
  • POST: http://localhost:8181/api/v1/people/json - Accepts a raw body of JSON. Adds a new person, returns the new list. JSON would be in the following format:
{
    "email": "[email protected]",
    "firstName": "Test",
    "lastName": "User"
}

Postman Collection

The repo includes a file Example-PeopleAPI.postman_collection which is a Postman URL collection.

With Postman installed, import and use to easily query the routes.

Issues

We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.

If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to http://jira.perfect.org:8080/servicedesk/customer/portal/1 and raise it.

A comprehensive list of open issues can be found at http://jira.perfect.org:8080/projects/ISS/issues

Further Information

For more information on the Perfect project, please visit perfect.org.

About

An Example JSON API for Perfect

Topics

json-apiperfectserver-side-swiftswift

Resources

Readme
Activity
Custom properties

Stars

44 stars

Watchers

2 watching

Forks

6 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.