Coder Social home page Coder Social logo

challenger's Introduction

Getting Started with Challenger React App

This project was bootstrapped with Create React App.

Require for cross platforms

npm install --save-dev cross-env

Available Scripts

In the project directory, you can run:

npm create vite@latest

√ Project name: ... vite-project
√ Select a framework: » React
√ Select a variant: » JavaScript + SWC

mv vite-project challenger
mkdir -p challenger/frontend

cd challenger/frontend
## Install Vite requirements
npm install

## Install specific server side requirements
npm install express body-parser fs

To run the project

Terminal 1
cd challenger/frontend
npm run dev

Terminal 2
cd challenger/frontend
node server.js

Update server port

To change the port for a React application that uses Vite, you can set the port option in the vite.config.js file. If you don't have a vite.config.js file in your project root, you can create one.

Example:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    port: 3001,
    proxy: {
      '/api': 'http://localhost:3002',
      '/scores': 'http://localhost:3002',
    }
  },
})

Another way is using npm run dev, you can modify the script in your package.json file to include the --port option. Here's how you can do it:

Example (added line "test": "vite --port 3024",):

  "scripts": {
    "dev": "vite",
    "test": "vite --port 3024",
    "build": "vite build",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },

With the above example you can run your project like this:

Terminal 1
cd challenger/frontend
npm run dev

Terminal 2
cd challenger/frontend
node server.js

Example Screenshot 1 Image 1

Example Screenshot 2 Image 2

Example Screenshot 3 Image 2

challenger's People

Contributors

gcclinux avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.