Skip to content

Swag666baby/rpg-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/