-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42bef38
commit 71715c5
Showing
14 changed files
with
136 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"watch": ["../../packages", "src"], | ||
"ext": "ts,json", | ||
"exec": "node --loader esbuild-register/loader -r esbuild-register ./src/index.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "@edge/server", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"main": "./src/index.mjs", | ||
"types": "./src/index.mjs", | ||
"scripts": { | ||
"build": "tsc", | ||
"dev": "nodemon", | ||
"typecheck": "tsc --noEmit", | ||
"clean": "rm -rf .turbo && rm -rf node_modules", | ||
"lint": "eslint . --ext .ts,.tsx,.mjs", | ||
"lint:fix": "pnpm lint --fix", | ||
"format": "prettier --write '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-unknown --no-error-on-unmatched-pattern", | ||
"format:check": "prettier --check '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-unknown --no-error-on-unmatched-pattern" | ||
}, | ||
"devDependencies": { | ||
"@edge/eslint-config": "^0.0.0", | ||
"@edge/prettier-config": "^0.0.0", | ||
"@edge/tsconfig": "^0.0.0", | ||
"@types/cors": "^2.8.17", | ||
"@types/express": "^4.17.21", | ||
"esbuild-register": "^3.5.0", | ||
"nodemon": "^3.0.2", | ||
"typescript": "^5.1.6" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"extends": [ | ||
"@edge/eslint-config/base" | ||
] | ||
}, | ||
"prettier": "@edge/prettier-config/base", | ||
"dependencies": { | ||
"@edge/env": "^0.0.0", | ||
"cors": "^2.8.5", | ||
"express": "^4.18.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import express from "express"; | ||
import { createServer } from "http"; | ||
import cors from "cors"; | ||
import { env } from "@edge/env"; | ||
|
||
const main = async () => { | ||
console.log(env, "XD"); | ||
const app = express(); | ||
app.use( | ||
cors({ | ||
// The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include' | ||
origin: [env.CLIENT_HOST, /http:\/\/localhost:\d{4}\/?.*$/], | ||
credentials: true, | ||
}), | ||
); | ||
|
||
const server = createServer(app); | ||
server.listen(env.API_PORT, () => { | ||
console.log(`Listening on port ${env.API_PORT}`); | ||
}); | ||
}; | ||
|
||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "@edge/tsconfig/base.json", | ||
"include": ["src"] | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/web/.cache/ts-import/home/pridestalkerr/Documents/dev/edge/packages/env/src/index.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createEnv } from "@t3-oss/env-core"; | ||
import { z } from "zod"; | ||
import "dotenv/config"; | ||
export const env = createEnv({ | ||
server: { | ||
NODE_ENV: z.enum(["development", "production"]), | ||
API_PORT: z.coerce.number(), | ||
DATABASE_URI: z.string().url(), | ||
CLIENT_HOST: z.string().url(), // useful for CORS | ||
}, | ||
clientPrefix: "NEXT_PUBLIC_", | ||
client: { | ||
NEXT_PUBLIC_API_HOST: z.string().url(), | ||
NEXT_PUBLIC_API_ENDPOINT: z.string(), | ||
}, | ||
runtimeEnv: { | ||
...process.env, | ||
NEXT_PUBLIC_API_HOST: process.env.API_HOST, | ||
NEXT_PUBLIC_API_ENDPOINT: process.env.API_ENDPOINT, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "turbo build", | ||
"dev": "turbo dev", | ||
"build": "cross-env NODE_ENV=production dotenv -- turbo build", | ||
"dev": "cross-env NODE_ENV=development dotenv -- turbo dev --parallel", | ||
"typecheck": "turbo typecheck", | ||
"clean": "turbo run clean && rm -rf node_modules", | ||
"lint": "turbo lint && manypkg check", | ||
|
@@ -25,6 +25,8 @@ | |
"dependencies": { | ||
"@manypkg/cli": "^0.21.1", | ||
"@types/node": "^20.10.3", | ||
"cross-env": "^7.0.3", | ||
"dotenv-cli": "^7.3.0", | ||
"prettier": "^3.1.1", | ||
"turbo": "^1.10.16", | ||
"typescript": "^5.3.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createEnv } from "@t3-oss/env-core"; | ||
import { z } from "zod"; | ||
|
||
export const env = createEnv({ | ||
server: { | ||
NODE_ENV: z.enum(["development", "production"]), | ||
API_PORT: z.coerce.number(), | ||
DATABASE_URI: z.string().url(), | ||
CLIENT_HOST: z.string().url(), // useful for CORS | ||
}, | ||
clientPrefix: "NEXT_PUBLIC_", | ||
client: { | ||
NEXT_PUBLIC_API_HOST: z.string().url(), | ||
NEXT_PUBLIC_API_ENDPOINT: z.string(), | ||
}, | ||
runtimeEnv: { | ||
...process.env, | ||
NEXT_PUBLIC_API_HOST: process.env.API_HOST, | ||
NEXT_PUBLIC_API_ENDPOINT: process.env.API_ENDPOINT, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "@edge/tsconfig/base.json", | ||
"include": ["src", "src/**/*.mjs"] | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters