proof of concept

This commit is contained in:
Jonas_Jones 2023-12-03 18:23:36 +01:00
parent aea93a5527
commit 6abba646c7
14 changed files with 1099 additions and 69098 deletions

128
.gitignore vendored
View file

@ -1,127 +1,3 @@
# Logs # Added by cargo
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html) /target
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

1067
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

12
Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "jonas_jones-api"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
warp = "0.3.6"
parking_lot = "0.12.1"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.34", features = ["macros"] }

38167
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,55 +0,0 @@
{
"name": "jonas_jones-api",
"version": "1.0.0",
"description": "an api used for my website",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon server.js --exec babel-node --presets babel-preset-env",
"lint": "eslint src/js",
"build": "react-scripts build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/j-onasJones/jonas_jones-api.git"
},
"keywords": [
"RESTful",
"API",
"node",
"mongoDB"
],
"author": "Jonas_Jones",
"license": "ISC",
"bugs": {
"url": "https://github.com/j-onasJones/jonas_jones-api/issues"
},
"homepage": "https://github.com/j-onasJones/jonas_jones-api#readme",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^9.1.2",
"babel-preset-env": "^1.7.0",
"body-parser": "^1.20.1",
"express": "^4.18.2",
"http": "^0.0.1-security",
"polyfills": "^2.1.1",
"react": "^18.2.0",
"react-scripts": "^5.0.1"
},
"devDependencies": {
"webpack-cli": "^5.0.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View file

View file

@ -1,26 +0,0 @@
import express from 'express';
const app = express();
app.get('/', (req, res) => {
res.send('Welcome to the jonas_jones-api!')
});
app.get('/projects', (req, res) => {
const keyword = req.query.keyword;
const version = req.query.version;
const platform = req.query.platform;
const topic = req.query.topic;
return res.status(200).json({
success: true,
projects: {
keyword: keyword,
version: version,
platform: platform,
topic: topic,
}
})
});
app.listen(8000, () => {
console.log('api listening on port 8000!')
});

18
src/main.rs Normal file
View file

@ -0,0 +1,18 @@
use warp::Filter;
#[tokio::main(flavor = "current_thread")]
async fn main() {
// GET /hello/warp => 200 OK with body "Hello, warp!"
let hello = warp::path!("hello" / String)
.map(|name| format!("Hello, {}!", name));
let root = warp::path::end()
.map(|| "Hello, World!");
let routes = hello.or(root);
warp::serve(routes)
.run(([127, 0, 0, 1], 3030))
.await;
}

View file

@ -1,41 +0,0 @@
{
projects: [
{
id: -1,
title: 'Template Project',
description_short: 'This is a template project.',
description: 'This is a template project. It\'s goals are to provide a template for future projects.',
technologies: ['A list of technologies used, not languages'],
languages: ['A list of languages used, not technologies'],
versions: ['A list of versions if not on github or modrinth'],
latest_release: 'The latest release if not on github or modrinth',
topics: ['A list of topics if not on github'],
platforms: ['A list of platforms if not on github', 'github', 'modrinth', 'curseforge', 'website'],
os: ['A list of operating systems if not on github', 'windows', 'linux', 'macos', 'android', 'ios'],
bg_image: 'https://link.to.image',
icon_image: 'https://link.to.image',
github: 'https://link.to.github/repo',
home: 'https://link.to.home.page',
status: 'Release',
},
{
id: 0,
title: 'Website V1',
description_short: 'My first attempt at a website.',
description: 'My first attempt at a website. It\'s goals were to list the projects I\'ve worked on and provide a way to contact me.',
technologies: ['HTML', 'CSS', 'JavaScript'],
image: 'https://via.placeholder.com/150',
github: 'https://github.com/J-onasJones/J-onasJones.github.io/',
live: '',
},
{
id: 1,
title: 'Project Two',
description: 'This is the second project',
technologies: ['HTML', 'CSS', 'JavaScript'],
image: 'https://via.placeholder.com/150',
github: '',
live: '',
}
]
}

View file

@ -1,70 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

File diff suppressed because it is too large Load diff

View file

@ -1,39 +0,0 @@
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"node-polyfill-webpack-plugin": "^2.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View file

@ -1,26 +0,0 @@
import express from 'express';
const app = express();
app.get('/', (req, res) => {
res.send('Welcome to the jonas_jones-api!')
});
app.get('/projects', (req, res) => {
const keyword = req.query.keyword;
const version = req.query.version;
const platform = req.query.platform;
const topic = req.query.topic;
return res.status(200).json({
success: true,
projects: {
keyword: keyword,
version: version,
platform: platform,
topic: topic,
}
})
});
app.listen(8000, () => {
console.log('api listening on port 8000!')
});