cyipt / cyipt-website

CyIPT website
https://www.cyipt.bike/
0 stars 2 forks source link

Rework API code to front controller #11

Closed mvl22 closed 6 years ago

mvl22 commented 6 years ago

The API has been built up organically, with lots of copy-and-pasted code, and increasingly unwieldy if/then statements which change various behaviour based on zoom level and user controls.

The whole /api/ hierarchy should be replaced with a single front controller implementation that provides an HTTP(S) mechanics layer and a CyIPT model which provides the database definitions.

mvl22 commented 6 years ago

Front controller, containing all the HTTP(S) mechanics implemented in: https://github.com/cyipt/cyipt-website/commit/dee9e4171aa980d7f7d795461cc36af15ec1ca3e

Models (i.e. each API call) implemented in https://github.com/cyipt/cyipt-website/commit/ac89ab42558da0fcde61d5ee42e4a0691e25902d ... https://github.com/cyipt/cyipt-website/commit/c17ad603d1b232d5894239fabd6cf30d4d24fa45

To add a new layer, just add another method in /api/cyiptModel.php.

@mem48 Please familiarise yourself with the new structure.

mvl22 commented 6 years ago

Deployment update to support the .htaccess rewrite done in https://github.com/cyipt/cyipt-deploy/commit/864f22d3eef1136208329b97a8bd92803ef81fff.