<commit_before>import Vapor

Route.get("/") { request in 
	return View(path: "welcome.html")
}

Route.get("json") { request in 
	let response: [String: Any] = [
		"number": 123,
		"string": "test",
		"array": [
			0, 1, 2, 3
		],
		"dict": [
			"name": "Vapor",
			"lang": "Swift"
		]
	]

	return response
}

Route.any("data/:id") { request in
	let response: [String: Any] = [
		"request.path": request.path,
		"request.data": request.data,
		"request.parameters": request.parameters,
	]

	return response
}

Route.get("session") { request in
	let response: Response
	do {
		let json: [String: Any] = [
                        "session.data": request.session.data,
                        "request.cookies": request.cookies,
                        "instructions": "Refresh to see cookie and session get set."
                ];
		response = try Response(status: .OK, json: json)
	} catch {
		response = Response(error: "Invalid JSON")
	}

	request.session.data["name"] = "Vapor"
	response.cookies["test"] = "123"

	return response
}

Route.get("heartbeat", closure: HeartbeatController().index)

print("Visit http://localhost:8080")

let server = Server()
server.run(port: 8080)
<commit_msg>back to 8000 for now<commit_after>import Vapor

Route.get("/") { request in 
	return View(path: "welcome.html")
}

Route.get("json") { request in 
	let response: [String: Any] = [
		"number": 123,
		"string": "test",
		"array": [
			0, 1, 2, 3
		],
		"dict": [
			"name": "Vapor",
			"lang": "Swift"
		]
	]

	return response
}

Route.any("data/:id") { request in
	let response: [String: Any] = [
		"request.path": request.path,
		"request.data": request.data,
		"request.parameters": request.parameters,
	]

	return response
}

Route.get("session") { request in
	let response: Response
	do {
		let json: [String: Any] = [
                        "session.data": request.session.data,
                        "request.cookies": request.cookies,
                        "instructions": "Refresh to see cookie and session get set."
                ];
		response = try Response(status: .OK, json: json)
	} catch {
		response = Response(error: "Invalid JSON")
	}

	request.session.data["name"] = "Vapor"
	response.cookies["test"] = "123"

	return response
}

Route.get("heartbeat", closure: HeartbeatController().index)

print("Visit http://localhost:8000")

let server = Server()
server.run(port: 8000)

{'fraction_non_alphanumeric': 0.16227519866164786, 'fraction_numerical': 0.016729401923881223, 'mean_word_length': 2.9148936170212765, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6466267', 'n_tokens_mistral': 873, 'n_tokens_neox': 781, 'n_words': 198}