API & Project Structure

Project Structure

  • App/Common folders

    • Config.js: main config variables for the app

    • Colors.js: config theme color for the app

    • Constants.js: Config wordpress URL, icons, categories...

    • Images.js: list of all images use for the app

    • Languages.js: main language file config

    • Layout.js: Use to config the main flexible homepage.

    • Tools: Common functions

  • src/Components: Common components that could be used many time, this could be a custom button, comment component, icon input...

  • src/Containers: most components of the app is putting here, you could change or re-structure by matching with your own project design.

  • src/Expo: Wrapper Expo function

  • src/Services: The Wodpress Api for the app you can refer to the Wordpress API -http://v2.wp-api.org/and custom your own function if you want to add more feature for the app.

  • src/Redux: Main action and reducer

  • src/Navigation: Wrapper function for react-nativigation v2.0

Debug app with Reacttotron

Link download on desktop: http://bit.ly/2L0R9gY

It's already configed with the project, after installed the Reacttotron you can see list of Log, Image, connection, API, Redux actions....

You can able to the config the app to work with Reactotron or React Native Debugger by change useReactotron:false (file common/Constants.js)

Below is the common API that use for the app

Get Products

GET https://your-hosting.com/wp-json/wp/v2/posts

This endpoint allows you to get list of products, detail from - http://bit.ly/2L3vvJi

Query Parameters

Name
Type
Description

page

number

Current page of the collection. Default is 1.

per_page

number

Maximum number of items to be returned in result set. Default is 10.

GET https://your-hosting.com/wp-json/wc/v2/categories

The app is base on An isomorphic JavaScript client for the WordPress REST API, please refer to this document for the detail - https://github.com/WP-API/node-wpapi

The detail API is clarify from - https://developer.wordpress.org/rest-api/reference/

Last updated