For Gamers By Gamers
This will be the backend. API services
For detailed documentation:
- cd into
website
folder - run
npm start
API DOCUMENTATION
You can also checkout the API documentation by running the application and going to http://localhost:8000/api/docs
route
- Fork this repo and clone it on your system.
- NVM (optional if you're not using docker) I'm using this for managing node versions.
- on the root folder run
nvm use
- on the root folder run
- Docker (optional) if you want to run this with docker. I'm using this with docker-compose.
- MySql please refer to specific OS installation and install version mysql:8.0.18. Also dont forget to create a user
RUN "ALTER USER 'your user name' IDENTIFIED WITH mysql_native_password BY 'your password';"
RUN "FLUSH PRIVILEGES;"
- On the root folder you will see a file named
the_env_file.txt
change this file name to.env
. After changing all you need to do is change some of the values from the filesMYSQL_PASSWORD=your password
MYSQL_ROOT_PASSWORD=same as mysql_password
MYSQL_DATABASE=development_db
TYPEORM_USERNAME= your mysql username
TYPEORM_PASSWORD= your mysql password
- On the root folder change the file name
the_env_file.txt
to.env
file uncommenthost:"localhost"
then commenthost: 'db'
. This error is explained in the docs. - run
npm install
. - Run the app using
npm run dev
. - Then run the migration
npm run typeorm migration:run
Note: Make sure you have mysql running. In macOS using brew brew services start mysql
. For now I don't know how to run it mysql on other OS. You don't have to run it on the background process though, as long as your mysql is running. Also if you're using DBMS, use your mysql credentials
- Inside the root folder run command
docker-compose up
. To kill docker rundocker-compose down
. My advice don't run it on detached mode so you can see the query logs - Then uncomment
TYPEORM_HOST=db
and commentTYPEORM_HOST=localhost
. - If the server is accepting connections then you can run
npm run typeorm migration:run
Note: If you're using DBMS use the host host:0.0.0.0
then your credentials.
- Test the api using Postman, Insomnia or Postwoman
- After the download goto
http://localhost:8000/api/v1/signup
- Then create a user.
{
"username":"nocap",
"email":"[email protected]",
"password":"password"
}