server as netlify function
This commit is contained in:
3
netlify.toml
Normal file
3
netlify.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[[edge_functions]]
|
||||||
|
function = "index" # The name of your file
|
||||||
|
path = "/api/*"
|
||||||
@@ -2,8 +2,9 @@ import { Hono } from "hono";
|
|||||||
import { cors } from "hono/cors";
|
import { cors } from "hono/cors";
|
||||||
import { RegisterController } from "@/controllers/register";
|
import { RegisterController } from "@/controllers/register";
|
||||||
import { LoginController } from "@/controllers/login";
|
import { LoginController } from "@/controllers/login";
|
||||||
|
import { handle } from "hono/netlify";
|
||||||
|
|
||||||
const app = new Hono();
|
const app = new Hono().basePath("/api");
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
"/api/v1/*",
|
"/api/v1/*",
|
||||||
@@ -17,17 +18,12 @@ app.use(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get("/", async (c) => {
|
app.get("/", (c) => {
|
||||||
return c.json({
|
return c.text("Hello Hono!");
|
||||||
message: "ok",
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/api/v1/register", RegisterController);
|
app.post("/v1/register", RegisterController);
|
||||||
|
|
||||||
app.post("/api/v1/login", LoginController);
|
app.post("/v1/login", LoginController);
|
||||||
|
|
||||||
export default {
|
export default handle(app);
|
||||||
port: Bun.env.SERVER_PORT,
|
|
||||||
fetch: app.fetch,
|
|
||||||
};
|
|
||||||
11832
package-lock.json
generated
11832
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ export const INITIAL_ZOOM = 17;
|
|||||||
/**
|
/**
|
||||||
* MapTiler style URL for the map
|
* MapTiler style URL for the map
|
||||||
*/
|
*/
|
||||||
export const MAP_STYLE = import.meta.env.VITE_MAPTILER_STYLE;
|
export const MAP_STYLE = typeof import.meta !== 'undefined' && import.meta.env?.VITE_MAPTILER_STYLE ? import.meta.env.VITE_MAPTILER_STYLE : '';
|
||||||
|
|
||||||
export const STATUSES = {
|
export const STATUSES = {
|
||||||
SUCCESS: "success",
|
SUCCESS: "success",
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*", "./server.ts"],
|
"@/*": ["./src/*", "netlify/edge-functions/*.ts"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.tsx", "./server.ts"],
|
"include": ["src/**/*.ts", "src/**/*.tsx", "netlify/edge-functions/*.ts"],
|
||||||
"exclude": ["node_modules", "dist"],
|
"exclude": ["node_modules", "dist"],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user