Swag666baby / rpg-crud

a rpg crud

Home Page:https://rpg-crud-v2b5.onrender.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

necessary

typescript

npm install -g typescript

running

git clone https://github.com/Swag666baby/rpg-crud
cd rpg-crud 
yarn
npm run build
npm start

examples

β€’ to create a new user πŸ–ŠοΈ

import axios from "axios";

const newUser = async() => {
    const post = await axios.post("http://localhost:3000/register", 
    {
        "id": "<randomId>",
        "name": "<userName>",
        "class": "<youClass">,
        "primary_weapon": "<youPrimaryWeapon>",
        "secondary_weapon": "<youSecondaryWeapon>"
    })
    console.log(post.data)
}

β€’ to modify the coins, rank, name and everything else ✏

import axios from "axios";

const newNameUser = async() => {
    const post = await axios.post("http://localhost:3000/modify", {"id": "<youId>", "name": "<newNameUser>"})
    console.log(post.data)
}

β€’ to delete a user πŸ—‘

import axios from "axios";

const deleteUser = async() => {
    const post = await axios.post("http://localhost:3000/delete", {"id": "<youId>"})
    console.log(post.data)
}

β€’ to search a user πŸ”Ž

import axios from "axios";

const searchUser = async() => {
    const request = await axios.get("http://localhost:3000/search?id=youId")
    console.log(request.data)
}

β€’ to have a view of all registered users πŸ“ƒ

import axios from "axios";

const allUsers = async() => {
    const request = await axios.get("http://localhost:3000/")
    console.log(request.data)
}

Some items are changed automatically, so I chose not to allow modification via the modify route. items like xp, level and patent. but if you still want to change them via route, go to src/routes/modifyUsers.ts and add them to newData.

https://rpg-crud-v2b5.onrender.com/