基于区块链的毕业设计Ethical-Eating – 合乎道德的饮食
本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Ethical-Eating – 合乎道德的饮食 是一篇很好的国外资料
Ethical-Eating
Project Team
- Steve Peters-Luciani (peterst5@oregonstate.edu)
- Jack Edwards (edwajack@oregonstate.edu)
- Abigail Lam (lamab@oregonstate.edu)
- Kyeongnam Kim (kimkyeon@oregonstate.edu)
- Ryan Murphy (murphyr2@oregonstate.edu)
MySQL Setup
First, follow these instructions to connect to the OSU VPN service.
Next, get your username, password, and the database host name from Canvas. Enter the information from Canvas in the db_config.js
file.
DO NOT COMMIT YOUR CREDENTIALS TO GITHUB!
Finally, run the db_conn_test.js
script to make sure everything is working:
- cd ./Ethical-Eating/node
- npm install mysql
- node scripts/db_conn_test.js
Running the application
- Create 2 terminal windows, 1 for Node and 1 for React
- Leave the node terminal in the core directory
- Change the directory to client ‘cd client’
- Make sure all node_modules are installed from the core (Node) and client (React) directories
- In the Node terminal, run ‘npm install’
- In the React terminal, run ‘npm install’
- Start Node and React
- If starting Node terminal for Development*, run ‘npm run dev’
- If starting Node terminal for Production, run ‘npm start’
- To start the React terminal, run ‘npm start’
*The Development run will watch for updates in Node and update htem in the browser in real time.
Creating Page Routes – Express portion
You should only have to create a route in Express if you are importing data from the database to use in a page.
-
Check to see if a category for your route exists in the ./routes directory before creating a new one
-
Add the function call for the route into the ./routes/{category}.js and setting an export keyword that describes the functionality
exports.index = function(req, res) { /* Routes all non-assigned routes to React home */ res.sendFile(path.join(__dirname + '/client/build/index.html')); }
-
In server.js, if a new category was created, require the file path for the category file
const site = require('./routes/site')
-
Create the API call (GET, POST, PUT) with the route and the function
app.get('*', site.index)
Creating Page Routes – React portion
If you’re creating a page that doesn’t require database access, you can just create it in React
- Create a {pagename}.jsx file in ./client/src/App/pages and fill with the necessary code
- Add the page export to the index.js file in the pages directory
- Add the page to the ./pages import array on App.js
- Add a new Route to the Switch in the Router, setting the path to be your desired URL path and the component to your page function
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they’re used to log you in. Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
道德饮食
项目团队彼得斯·卢西亚尼(peterst5@oregonstate.edu)杰克·爱德华兹(edwajack@oregonstate.edu)林亚碧(lamab@oregonstate.edu)金敬南(kimkyeon@oregonstate.edu)
- 瑞安·墨菲(murphyr2@oregonstate.edu)
- cd./Ethical Eating/node
- npm安装mysql
- node脚本/数据库连接_测试.js
- 创建两个终端窗口,1表示Node,1表示React将节点终端保留在核心目录中,将目录更改为client“cd client”
MySQL Setup
首先,按照以下说明连接到OSU VPN服务。
接下来,从Canvas获取用户名、密码和数据库主机名。在数据库中输入来自画布的信息_配置文件文件。
不要向GITHUB提交您的凭据!
最后,运行数据库连接_测试.js确保一切正常的脚本:
- 将节点终端保留在核心目录中
- 将目录更改为client“cd client”
- 确保所有节点模块都是从节点的core(Node)和client(React)目录安装的终端,在React终端运行“npm install”,在节点终端运行“npm install”
Running the application
- ,在React终端运行“npm install”
- 如果正在启动节点终端进行开发*,则运行“npm run dev”
- 在服务器.js,如果创建了新类别,则需要类别文件const site=require(’./routes/site’)的文件路径。
*开发运行将监视Node中的更新,并在浏览器中实时更新htem。
Creating Page Routes – Express portion
如果要从数据库导入数据以在页面中使用,则只需在Express中创建路由。
- 向路由器中的交换机添加新路由,设置所需的URL路径和页面函数的组件
-
将该路由的函数调用添加到./routes/{category}.js中,并设置一个描述中功能的export关键字服务器.js,如果创建了新类别,需要类别文件的文件路径
exports.index = function(req, res) { /* Routes all non-assigned routes to React home */ res.sendFile(path.join(__dirname + '/client/build/index.html')); }
-
使用路由和函数创建API调用(GET、POST、PUT)
const site = require('./routes/site')
-
如果您要创建一个不需要数据库访问的页面,您可以在React中创建它
app.get('*', site.index)
Creating Page Routes – React portion
我们使用可选的第三方分析cookie来了解您如何使用GitHub.com网站所以我们可以打造更好的产品。了解更多。
- Create a {pagename}.jsx file in ./client/src/App/pages and fill with the necessary code
- Add the page export to the index.js file in the pages directory
- Add the page to the ./pages import array on App.js
- Add a new Route to the Switch in the Router, setting the path to be your desired URL path and the component to your page function
我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。
您可以随时通过单击页面底部的Cookie首选项来更新您的选择。有关更多信息,请参阅我们的隐私声明。
我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多
Essential cookies
我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多信息
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Ethical-Eating – 合乎道德的饮食