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 { RegisterController } from "@/controllers/register";
|
||||
import { LoginController } from "@/controllers/login";
|
||||
import { handle } from "hono/netlify";
|
||||
|
||||
const app = new Hono();
|
||||
const app = new Hono().basePath("/api");
|
||||
|
||||
app.use(
|
||||
"/api/v1/*",
|
||||
@@ -17,17 +18,12 @@ app.use(
|
||||
}),
|
||||
);
|
||||
|
||||
app.get("/", async (c) => {
|
||||
return c.json({
|
||||
message: "ok",
|
||||
});
|
||||
app.get("/", (c) => {
|
||||
return c.text("Hello Hono!");
|
||||
});
|
||||
|
||||
app.post("/api/v1/register", RegisterController);
|
||||
app.post("/v1/register", RegisterController);
|
||||
|
||||
app.post("/api/v1/login", LoginController);
|
||||
app.post("/v1/login", LoginController);
|
||||
|
||||
export default {
|
||||
port: Bun.env.SERVER_PORT,
|
||||
fetch: app.fetch,
|
||||
};
|
||||
export default handle(app);
|
||||
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
|
||||
*/
|
||||
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 = {
|
||||
SUCCESS: "success",
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
"baseUrl": ".",
|
||||
"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"],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user