Skip to content

Instantly share code, notes, and snippets.

@lejonmanen
Last active September 26, 2024 15:04
Show Gist options
  • Save lejonmanen/d471f359f23ec9a7bd1c32c0545020ed to your computer and use it in GitHub Desktop.
Save lejonmanen/d471f359f23ec9a7bd1c32c0545020ed to your computer and use it in GitHub Desktop.
Fullstack MERN with TypeScript
# Add your secrets here
CONNECTION_STRING=yes-here
npm init vite@latest
Välj React, TypeScript
cd mapp/
npm i react-router-dom zustand cors express joi
npm i --save-dev @types/express
git init
Skapa filerna: .env, tsconfig.backend.json
Skapa mapparna: backendSrc, backendDist
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"backend": "tsc --project tsconfig.backend.json && node --env-file .env ./backendDist/server.js"
},
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": false,
"outDir": "./backendDist/",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["backendSrc"]
}
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': {
target: 'http://localhost:1337/'
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment