import Vapor

// MARK: -- Properties
let maxList: Int = 100 //Maximum amount of names which can be reqested in one shot
//let defaultHead: String = "<head><meta charset='utf-8'></head>"


// MARK: -- Configuration
print("\n Praeparando Nomina-Romanorum...")
print("Docendo artem operandi...")
let nameBuilder = NameBuilder() // create NameBuilder object
let drop = Droplet() //create Droplet object
print("Ars operandi docta est\n")
print("Configuratione completa est!\n\n")


// MARK: -- Program
print("Incipit executio!")
// MARK: Register routes and handlers
//default route -> name generation
drop.get { req in return nameBuilder.next() }

//get many names all at once
drop.get("list", Int.self) { req, amount in
  guard amount <= maxList else { //check we aren't requesting too many names
      return "ERROR: Parameter 'amount' must be a natural number between 0 and \(maxList).\nYou can't request more than \(maxList) names all at once.\n\nNon è possibile richiedere più di \(maxList) nomi in un colpo solo.\n"
  }
  var names: String = ""
  for i in 0 ..< amount {
    names += "\(nameBuilder.next())\n"
  }
  return names
}

//Brusky's easter egg
drop.get("/brusky") { req in return "BRUSCHIIIIII!! \n PARACADUTE! PARACADUTE!" }

//my easter egg
drop.get("w") { req in return "Walter è un fregno della madonna" }


// MARK: Server start
drop.run()

import Vapor

// MARK: -- Properties
//let defaultHead: String = "<head><meta charset='utf-8'></head>"


// MARK: -- Configuration
print("\n Praeparando Nomina-Romanorum...")
print("Docendo artem operandi...")
let nameBuilder = NameBuilder() // create NameBuilder object
let drop = Droplet() //create Droplet object
print("Ars operandi docta est\n")
print("Configuratione completa est!\n\n")


// MARK: -- Program
print("Incipit executio!")
// MARK: Register routes and handlers
//default route -> name generation
drop.get { req in return nameBuilder.next() }

//Brusky's easter egg
drop.get("/brusky") { req in return "BRUSCHIIIIII!! \n PARACADUTE! PARACADUTE!" }

//my easter egg
drop.get("w") { req in return "Walter è un fregno della madonna" }


// MARK: Server start
drop.run()

--- 
+++ 
@@ -1,6 +1,7 @@
 import Vapor
 
 // MARK: -- Properties
+let maxList: Int = 100 //Maximum amount of names which can be reqested in one shot
 //let defaultHead: String = "<head><meta charset='utf-8'></head>"
 
 
@@ -19,6 +20,18 @@
 //default route -> name generation
 drop.get { req in return nameBuilder.next() }
 
+//get many names all at once
+drop.get("list", Int.self) { req, amount in
+  guard amount <= maxList else { //check we aren't requesting too many names
+      return "ERROR: Parameter 'amount' must be a natural number between 0 and \(maxList).\nYou can't request more than \(maxList) names all at once.\n\nNon è possibile richiedere più di \(maxList) nomi in un colpo solo.\n"
+  }
+  var names: String = ""
+  for i in 0 ..< amount {
+    names += "\(nameBuilder.next())\n"
+  }
+  return names
+}
+
 //Brusky's easter egg
 drop.get("/brusky") { req in return "BRUSCHIIIIII!! \n PARACADUTE! PARACADUTE!" }
 
Add path to request many names at once
