Add customer API stub
This commit is contained in:
10
api-customer/.idea/.gitignore
generated
vendored
Normal file
10
api-customer/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
21
api-customer/.idea/api-customer.iml
generated
Normal file
21
api-customer/.idea/api-customer.iml
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="Flask">
|
||||
<option name="enabled" value="true" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.11 (api-customer)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/../api-customer\templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
||||
12
api-customer/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
12
api-customer/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<list>
|
||||
<option value="grovepi" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
6
api-customer/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
api-customer/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
7
api-customer/.idea/misc.xml
generated
Normal file
7
api-customer/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.11 (api-customer)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (api-customer)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
api-customer/.idea/modules.xml
generated
Normal file
8
api-customer/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/api-customer.iml" filepath="$PROJECT_DIR$/.idea/api-customer.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
api-customer/.idea/vcs.xml
generated
Normal file
6
api-customer/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
17
api-customer/Dockerfile
Normal file
17
api-customer/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV FLASK_APP=app.py
|
||||
ENV FLASK_RUN_HOST=0.0.0.0
|
||||
ENV FLASK_RUN_PORT=5000
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["flask", "run"]
|
||||
12
api-customer/app.py
Normal file
12
api-customer/app.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
return 'Hello World!'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
||||
25
api-customer/docker-compose.yml
Normal file
25
api-customer/docker-compose.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
customer-api:
|
||||
build: .
|
||||
container_name: "clask-API"
|
||||
ports:
|
||||
- "5000:5000"
|
||||
depends_on:
|
||||
- mongo
|
||||
environment:
|
||||
- MONGO_URI=mongodb://mongo:27017/mydb
|
||||
|
||||
mongo:
|
||||
image: mongo:latest
|
||||
container_name: "customer-database"
|
||||
environment:
|
||||
- MONGO_INITDB_DATABASE=customer-db
|
||||
- MONGO_INITDB_ROOT_PASSWORD=secret
|
||||
- MONGO_INITDB_ROOT_USERNAME=root
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- ./mongo-data:/data/db
|
||||
- ./mongo-init:/docker-entrypoint-initdb.d
|
||||
12
api-customer/mongo-init/mongo-init.js
Normal file
12
api-customer/mongo-init/mongo-init.js
Normal file
@@ -0,0 +1,12 @@
|
||||
db = db.getSiblingDB("customer-db");
|
||||
|
||||
db.createCollection("systems");
|
||||
db.createCollection("games");
|
||||
|
||||
db.createUser({
|
||||
user: "user",
|
||||
pwd: "psk358xpg",
|
||||
roles: [
|
||||
{ role: "readWrite", db: "customer-db" }
|
||||
]
|
||||
});
|
||||
1
api-customer/requirements.txt
Normal file
1
api-customer/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
flask
|
||||
Reference in New Issue
Block a user