[V2+] api_sender.html

Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
This commit is contained in:
Charles Le Maux 2024-06-25 23:51:48 +01:00
parent 628e2b0300
commit b17f316491
4 changed files with 64 additions and 3 deletions

View File

@ -100,7 +100,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
function sendRequest(endpoint, payload) { function sendRequest(endpoint, payload) {
return fetch(`http://localhost:3000/${endpoint}`, { return fetch(`http://192.168.1.94:3000/${endpoint}`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

2
app.py
View File

@ -108,4 +108,4 @@ def dynamic_route_handler(path):
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000, debug=True) app.run(host='0.0.0.0', port=3000, debug=False)

View File

@ -120,7 +120,7 @@ def account_delete(user: UserRecord, subdomain: str) -> tuple[HTTPStatus, str or
except Exception as e: except Exception as e:
return HTTPStatus.NOT_FOUND, f"Database deletion failed | {e}" return HTTPStatus.NOT_FOUND, f"Database deletion failed | {e}"
try: try:
file_manager.remove_stream_config() file_manager.remove_stream_config(port, subdomain)
except Exception as e: except Exception as e:
return HTTPStatus.INTERNAL_SERVER_ERROR, f"Nginx deletion failed. {str(e)}" return HTTPStatus.INTERNAL_SERVER_ERROR, f"Nginx deletion failed. {str(e)}"
return HTTPStatus.OK, f"Successfully deleted user {user_id}." return HTTPStatus.OK, f"Successfully deleted user {user_id}."

61
readme.md Normal file
View File

@ -0,0 +1,61 @@
# Servii - Backend
[![PyPI](https://img.shields.io/pypi/v/PyGithub.svg)](https://pypi.python.org/pypi/PyGithub)
![CI](https://github.com/PyGithub/PyGithub/workflows/CI/badge.svg)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Servii is a cutting-edge project designed to streamline the management of Minecraft servers and facilitate seamless integration with frontend applications.
Built with modern technologies like [Firebase], Servii offers a robust backend for launching Minecraft servers and serves as a comprehensive API for frontend projects, enhancing the gaming experience through efficient server management and automation.
This [GitHub] repository has a production goal, workflows will be soon integrated.
[Firebase]: https://firebase.google.com/
[GitHub]: https://github.com
## Installation guide
#### Download the repository.
```bash
git clone https://github.com/charleslemaux/servii-backend.git
cd servii-backend
```
#### Install virtualenv.
```bash
pip3 install virtualenv
```
#### Enable it.
```bash
virtualenv venv
//UNIX
source venv/bin/activate
//windows
venv\Scripts\activate
```
#### Install dependencies.
```bash
pip install -r requirements.txt
```
#### Launch !
```bash
gunicorn
```
## Documentation
The [documentation] isn't public yet.
[documentation]: https://doc.servii.fr/back-end
## Development
### Contributing
Long-term discussion and bug reports are maintained via GitHub Issues.
Code review is done via GitHub Pull Requests.
### Maintainership
We're actively seeking maintainers that will triage issues and pull requests and cut releases.
If you work on a project that leverages Servii and have a vested interest in keeping the code alive and well, send an email to [charles@le-maux.dev], thank you for reading.
[charles@le-maux.dev]: charles@le-maux.dev