feat: Better styling on web pages, bad-words check now has less edge cases.
This commit is contained in:
@@ -5,13 +5,18 @@ import Vapor
|
||||
struct ApiController: RouteCollection {
|
||||
|
||||
func boot(routes: any RoutesBuilder) throws {
|
||||
let users = routes.grouped("api", "users")
|
||||
let api = routes.grouped("api")
|
||||
let users = api.grouped("users")
|
||||
let proCon = api.grouped("procons")
|
||||
let utils = api.grouped("utils")
|
||||
|
||||
users.get(use: usersIndex(req:))
|
||||
users.post(use: createUser(req:))
|
||||
|
||||
let proCon = routes.grouped("api", "procons")
|
||||
proCon.get(use: prosAndConsIndex(req:))
|
||||
proCon.post(use: createProCon(req:))
|
||||
|
||||
utils.post("check-words", use: checkWords(req:))
|
||||
}
|
||||
|
||||
@Sendable
|
||||
@@ -39,6 +44,17 @@ struct ApiController: RouteCollection {
|
||||
return proCon
|
||||
}
|
||||
|
||||
@Sendable
|
||||
func checkWords(req: Request) async throws -> HTTPStatus {
|
||||
let input = try req.content.decode(CheckWords.self)
|
||||
try checkForBadWords(in: input.string)
|
||||
return .ok
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct CheckWords: Content {
|
||||
let string: String
|
||||
}
|
||||
|
||||
struct ProConDTO: Content {
|
||||
|
||||
Reference in New Issue
Block a user