Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
14 changes: 14 additions & 0 deletions react-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# PIMS React APP

This service runs using Node and is built using the Vite development environment and the React framework.

## Commands

These commands are specific to the `/react-app` folder.

The available commands for the frontend app are as follows:

| Command | Description |
| -------------------------- | ------------------------------------------------------------------------ |
| `npm run dev` | Runs app in development mode. |
| `npm run build` | Builds the app into runnable JavaScript, located in the `/dist` folder. |
15 changes: 15 additions & 0 deletions react-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PIMS</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>

</html>
21 changes: 21 additions & 0 deletions react-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "pims-frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build"
},
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/react": "18.2.43",
"@types/react-dom": "18.2.17",
"@vitejs/plugin-react": "4.2.1",
"typescript": "5.2.2",
"vite": "5.0.8"
}
}
Empty file added react-app/src/App.css
Empty file.
7 changes: 7 additions & 0 deletions react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import './App.css';

const App = () => {
return <></>;
};

export default App;
9 changes: 9 additions & 0 deletions react-app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
1 change: 1 addition & 0 deletions react-app/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
20 changes: 20 additions & 0 deletions react-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"composite": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src/**/*", "vite.config.ts"]
}
27 changes: 27 additions & 0 deletions react-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
// This configuration is only relevant when running dev locally using Vite.
// Production build is handled by NGINX, which has its own settings.
export default () => {
const frontendPort: number = 3000;
const target = `http://localhost:5000`;

return defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
},
server: {
host: true,
port: frontendPort,
proxy: {
'/api': {
target: target,
changeOrigin: true,
},
},
},
});
};