velocious 1.0.107 → 1.0.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "velocious": "bin/velocious.js"
4
4
  },
5
5
  "name": "velocious",
6
- "version": "1.0.107",
6
+ "version": "1.0.108",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "lint": "eslint",
@@ -3,6 +3,10 @@ import Routes from "../../../../src/routes/index.js"
3
3
  const routes = new Routes()
4
4
 
5
5
  routes.draw((route) => {
6
+ route.namespace("api", (route) => {
7
+ route.post("version")
8
+ })
9
+
6
10
  route.resources("projects")
7
11
 
8
12
  route.resources("tasks", (route) => {
@@ -0,0 +1,9 @@
1
+ import Controller from "../../../../../src/controller.js"
2
+
3
+ export default class ApiController extends Controller {
4
+ version() {
5
+ this.renderJsonArg({
6
+ version: "2.1"
7
+ })
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ import fetch from "node-fetch"
2
+
3
+ import Dummy from "../dummy/index.js"
4
+
5
+ describe("HttpServer - namespace", {databaseCleaning: {transaction: false, truncate: true}}, async () => {
6
+ it("handles post requests", async () => {
7
+ await Dummy.run(async () => {
8
+ const response = await fetch(
9
+ "http://localhost:3006/api/version",
10
+ {method: "POST"}
11
+ )
12
+ const data = /** @type {Record<string, any>} */ (await response.json())
13
+
14
+ expect(data.version).toEqual("2.1")
15
+ })
16
+ })
17
+ })
@@ -2,7 +2,7 @@
2
2
 
3
3
  import restArgsError from "../utils/rest-args-error.js"
4
4
  import BaseRoute from "./base-route.js"
5
- import BasicRoute from "./base-route.js"
5
+ import BasicRoute from "./basic-route.js"
6
6
  import escapeStringRegexp from "escape-string-regexp"
7
7
 
8
8
  class VelociousRouteNamespaceRoute extends BasicRoute {