Giter Site home page Giter Site logo

qiuzcc / cors_expriment Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 37 KB

用于探究前后端常用跨域方式的demo,用最简洁的代码,只包含必须的功能和文件。探究4种跨域方式:Vite开发服务器代理、自定义CORS、cors库、Nginx配置代理

JavaScript 48.90% HTML 2.14% Vue 48.96%

cors_expriment's Introduction

项目主要结构

后端 backend
├── app.js   主要代码,在这里进行四个实验的切换
├── CORS	
|  ├── custom_cors.js	自定义配置CORS
|  └── npm_cors.js		cors库进行配置CORS
└── routes
   └── index.js			路由和功能逻辑
   
前端 fronted
├── src
|  ├── App.vue			主组件,在这里切换不同的实验
|  ├── Expriment1.vue	 实验一,不进行任何配置
|  ├── Expriment2.vue	 实验二,使用Vite的dev server配置正向代理
|  ├── Expriment3.vue	 实验三,后端手动配置CORS
|  ├── Expriment4.vue	 实验四,后端使用cors库进行配置
|  ├── Expriment5.vue	 实验五,通过Nginx配置(正向)代理
└── vite.config.js		实验二需要用到

实验方法

fronted/backend/下的 readme 文档注明了进行不同实验的方式。前后端项目之间只需要保持实验次序一致即可!

实验文档

手把手带你实践4种前端跨域方式(附源码) - timegogo

cors_expriment's People

Contributors

qiuzcc 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.