Git Product home page Git Product logo

yii2-rest's Introduction

TEST REST API APPLICATION ON Yii2

Build Status

Demo Server

INSTALLATION

Install via Composer

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install the application using the following commands:

composer global require "fxp/composer-asset-plugin:~1.0.0"
composer create-project --prefer-dist -s dev "githubjeka/rest-yii2" .

GETTING STARTED

After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.

  • Run command php init --env=Development to initialize the application with a specific environment.
  • Create a new database and adjust the components['db'] configuration in common/config/main-local.php accordingly.
  • Apply migrations with console command php yii migrate. This will create tables needed for the application to work.
  • Set document roots of your Web server:

for rest /path/to/yii-application/rest/web/ and using the URL http://localhost/ for backend /path/to/yii-application/backend/web/ and using the URL http://backend-localhost/

Use demo/demo to login into the application on http://localhost/v1/user/login. See /rest/config/main.php for more info by URL

URL RULE

See rest/config/main.php

API available:

// version 1
OPTIONS /index.php?r=v1/user/login
POST /index.php?r=v1/user/login

OPTIONS /index.php?r=v1/posts
GET /index.php?r=v1/posts
GET /index.php?r=v1/posts/ID
POST /index.php?r=v1/posts
PUT /index.php?r=v1/posts/ID
DELETE /index.php?r=v1/posts/ID

OPTIONS /index.php?r=v1/comments
GET /index.php?r=v1/comments
GET /index.php?r=v1/comments/ID
POST /index.php?r=v1/comments
PUT /index.php?r=v1/comments/ID
DELETE /index.php?r=v1/comments/ID

//version 2
OPTIONS /index.php?r=v2/user/login
POST /index.php?r=v2/user/login

You can hide index.php from URL. For that see server.md

ADDITIONALLY

See client on AngularJS

yii2-rest's People

Contributors

bryant1410 avatar githubjeka avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.