简体   繁体   中英

is it possible to built REST API without knowing about frontend for mobiles apps

This could be a silly question but I want to confirm about it. I am a backend Laravel developer and have created my website. Now I want to create mobile mobile apps but have no knowledge of front-end.

Due to lockdown situations I want to use this time to create the backend API for my apps. Now I want to know is it ok or a normal practice to create APIs without knowing anything about front end. (Like is it possible that I just create all the endpoints now that are throwing data in JSON and then the front-end developer will use them to integrate in the front-end? Thanks

PS: I dont know how the app front-end will look like but I know what data will be needed in each page/view.

I think you can do this easily with graphql.

A Frontend dev and also beginners with Apollo in the frontend can easily introspect and build the stuff.

If you can choose your Frontend stack there is no problem with rest either.

I always do the Frontend first approach. Mocking the data for graphql types and building the api later seems to me the best workflow ever.

See ya. Much fun with your project

Yes it is possible very possible to do that it would be nice is the API is well documented using postman or swagger for a better experience when frontend engineers want to integrate

Many API's in the world today are never consumed by a browser or app on the frontend, sure it can make life easier knowing why you are building it.

But at the end of the day, a good API is simple and easy to understand. It just allows a developer to fetch data from a system but normally with some idea about each type of request.

For example, if you had an API for a university the endpoints could be as follows:

/pupils => Get/Sets pupil data.  
/teachers => Get/Sets teacher data.  
/classes => Get/Sets class subjects and references ID's of both Pupils and Teachers.

So if you wanted all the Pupils in a given class you would query the /classes endpoint and then for each Pupil ID you would query the /pupil endpoint.

Sometimes not having a frontend makes the API even more generic because you might think differently when you do not have a frontend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM