Vapor Controller Endpoints (Swift Web Framework)

Thanks to John Bona from Vapor slack I got to know how the endpoint actually look like

Here is how my simplified Socks controller looks, this controller takes care of Sock model.

First line is the endpoint, the second is method notation.

//  SockController.swift
GET [/socks]
func index(request: Request) ...
POST [/socks]
func create(request: Request) ...
GET [/socks/1]
func show(request: Request, sock: Sock) ...
DELETE [/socks/1]
func delete(request: Request, sock: Sock) ...
DELETE [/socks]
func clear(request: Request) ...
PATCH [/socks/1]
func update(request: Request, sock: Sock) ...
PUT [/socks/1]
func replace(request: Request, sock: Sock) ...
func makeResource() -> Resource<Sock> {
return Resource(
index: index,
store: create,
show: show,
replace: replace,
modify: update,
destroy: delete,
clear: clear
)
}

This is a piece of middleware from which “…/socks…” in URL came from

let url = baseUrl + "socks/\(id)"

You can find Postman Collection over here: https://www.getpostman.com/collections/a60d3204f05470b97dd5

Reference in Vapor source codes is here: 
vapor/routing/resource.swift #91

You can checkout my whole source code on Github:
https://github.com/syky27/LostSocks-api

Happy Coding!