S
S
Sergey2018-11-27 21:32:19
RESTful API
Sergey, 2018-11-27 21:32:19

How do you develop Rest API?

Now the development of applications using Api (SPA and mobile) looks like this:

  • Technical specifications are being written (more for the client than for developers)
  • The backender composes end-point fixtures (json files or objects in js)
  • If you need to work with an external server, the backender writes the TOR for what is required of them
  • Backender writes code and creates a project in Postman based on it and changes abstract fixtures to more real ones as end points are written
  • Frontender writes an application on fixtures and documentation from Postman as they are created
  • Everything is hand-tested

Now I would like to start at least away from fixtures and switch to a mock server, which would be automatically generated according to OpenAPI (swagger) schemes with fake data. But so far I have not been able to properly raise the mock prism server.
Google searches mostly for basics like https://habr.com/post/351890/
Can you share your working methods?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
F
float64, 2018-11-29
@gangstarcj

I support the topic with graphql - but here you need to understand that in order to use it, you still need to first create a REST API with basic CRUD operations from which graphql will already collect everything you need.
On the main topic, I can say that the best approach to create a REST API with automatic generation of Swagger / Open API specifications that I have seen is called "Model Driven Design" - here is an article about it: https://strongloop.com/strongblog/node-js-api -tip-...
Article from the developers of the loopback framework: https://loopback.io
Judging by your question, you have a js backend, so you can try it - this is just a specialized framework for creating API servers. Generates the entire API for all application models automatically + methods for all relational relationships + allows you to add your own methods.
There is also a solution for the PHP stack: https://api-platform.com but it is still inferior to loopback due to incomplete support for automatic creation of endpoints for relational links.
My recommendation:
1) Read about model driven design
2) Make a list of your application models
3) Write the fields, methods and relationships of each model
4) Generate an API according to the description received, document it, spice it up, serve it to the table

O
Oleg Gamega, 2018-11-28
@gadfi

Technical specifications are being written (more for the client than for developers)
TK first of all needs developers
api documentation should be written by a front-end developer focusing on design - he is also planning to work with this
ps we plan to go to graphql

A
Alexey Nikolaev, 2018-11-27
@Heian

Can you share your working methods?

Somehow it's hard for you. It’s simple for me: an API is written, then all this is entered into Postman, something that was not tested with matyuks was tested in the process of work and surrendered.

O
oldhowl, 2018-11-28
@oldhowl

We do not use Postman as such. For the API documentation, we use swagger in conjunction with the .net core, on which we also code the client API for the front. Never had a problem and saves a lot of time.
While we are sawing the back, the front is typesetting the pages, we give the back in parts. We simply coordinate what we saw and work in parallel.

C
chibitko, 2018-11-28
@chibitko

.net (core) + swashbuckle
fronters write a prototype, gradually screwing up api

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question