Won-Games / api

Strapi API to our Ecommerce

Home Page:https://reactavancado.com.br/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DigitalOcean Referral Badge

React Avançado - Won Games API

This is the API to create the Won Games Store from React Avançado course.

Requirements

This project uses PostgreSQL, so, in order to make it working, install in your local machine or use Docker.

The configuration to the Database can be found on config/database.js

Development

After cloning this project, install the dependencies:

yarn install

And run using:

yarn develop

The urls to access are:

  • http://localhost:1337/admin - The Dashboard to create and populate data
  • http://localhost:1337/graphql - GraphQL Playground to test your queries

The first time to access the Admin you'll need to create an user.

Populate data

This project uses a /games/populate route in order to populate the data via GoG site. In order to make it work, follow the steps:

  • Go to Roles & Permissions > Public and make sure game:populate route is public available and the upload as well
  • With Strapi running run the following comand in your console:
$ curl -X POST http://localhost:1337/games/populate

# you can pass query parameters like:
$ curl -X POST http://localhost:1337/games/populate?page=2
$ curl -X POST http://localhost:1337/games/populate?search=simcity
$ curl -X POST http://localhost:1337/games/populate?sort=rating&price=free
$ curl -X POST http://localhost:1337/games/populate?availability=coming&sort=popularity

Using dump

First of all, you need to download our dump.sql from our database repository.

  1. Create a Postgres database and user:
CREATE USER wongames WITH ENCRYPTED PASSWORD 'wongames123';
CREATE DATABASE wongames OWNER wongames;
  1. Populate the new database, using the following command (remember to point the place where you have the dump.sql):
psql -h localhost -p 5432 -U wongames wongames < dump.sql

And you can access localhost:1337/admin with the following credentials:

email: wongames@wongames.com
password: Wongames123

About

Strapi API to our Ecommerce

https://reactavancado.com.br/


Languages

Language:JavaScript 99.1%Language:Dockerfile 0.8%Language:Shell 0.1%