Skip to content

Commit

Permalink
backend: added nitro server for ts backend
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwiseman committed Jul 8, 2024
1 parent 8f4800e commit eb99cbc
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 3 deletions.
46 changes: 46 additions & 0 deletions apps/nitro/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json", // Update the path to your tsconfig.json file
},
plugins: ["@typescript-eslint"],
extends: [
"plugin:@next/next/recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
require.resolve("@vercel/style-guide/eslint/node"),
require.resolve("@vercel/style-guide/eslint/browser"),
require.resolve("@vercel/style-guide/eslint/typescript"),
require.resolve("@vercel/style-guide/eslint/react"),
require.resolve("@vercel/style-guide/eslint/next"),
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",

"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: { attributes: false },
},
],
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-return-await": "off",
"import/no-default-export": "off",
"import/no-extraneous-dependencies": "off",
},
};

module.exports = config;
7 changes: 7 additions & 0 deletions apps/nitro/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
.data
.nitro
.cache
.output
.env
2 changes: 2 additions & 0 deletions apps/nitro/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
3 changes: 3 additions & 0 deletions apps/nitro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Nitro starter

Look at the [nitro quick start](https://nitro.unjs.io/guide#quick-start) to learn more how to get started.
Binary file added apps/nitro/bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions apps/nitro/nitro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//https://nitro.unjs.io/config
export default defineNitroConfig({
srcDir: "server"
});
13 changes: 13 additions & 0 deletions apps/nitro/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@quotes/nitro",
"private": true,
"scripts": {
"build": "nitro build",
"dev": "nitro dev --port 3001",
"prepare": "nitro prepare",
"preview": "node .output/server/index.mjs"
},
"devDependencies": {
"nitropack": "latest"
}
}
6 changes: 6 additions & 0 deletions apps/nitro/server/routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { db, eq, quote } from "@quotes/db"

export default eventHandler(async (event) => {
const data = await db.query.quote.findFirst({ where: eq(quote.id, 1) })
return "Start by editing <code>server/routes/index.ts</code>.";
});
7 changes: 7 additions & 0 deletions apps/nitro/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// https://nitro.unjs.io/guide/typescript
{
"extends": "./.nitro/types/tsconfig.json",
"compilerOptions": {
"strictNullChecks": true
}
}
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/db-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
},
"dependencies": {
"@quotes/db": "^0.1.0",
"@types/fluent-ffmpeg": "^2.1.24",
"@types/uuid": "^10.0.0",
"fluent-ffmpeg": "^2.1.3",
"srt-parser-2": "^1.2.3",
"uuid": "^10.0.0"
},
"devDependencies": {
"@types/fluent-ffmpeg": "^2.1.24",
"@types/uuid": "^10.0.0",
"@quotes/eslint-config": "^0.2.0",
"@quotes/prettier-config": "^0.1.0",
"@quotes/tsconfig": "^0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"lucide-react": "^0.358.0",
"next-themes": "^0.2.1",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.50.1",
"react-hook-form": "^7.52.1",
"react-input-mask": "^2.0.4",
"react-resizable-panels": "^2.0.13",
"sonner": "^1.4.3",
Expand Down

0 comments on commit eb99cbc

Please sign in to comment.