loading...

The best way to make a web API

dbanty profile image Dylan Anthony ・1 min read

What’s your favorite way to make a web API? Give us an outline:

  • Programming Language
  • Framework
  • Scheme/spec/standard
  • Documentation
  • Authentication
  • Authorization
  • Client libraries?

Here’s my example:

  • Python
  • Flask
  • OpenAPI REST (I use Flask-RESTPlus)
  • Swagger UI
  • JWT (Bearer token) with Flask-Login
  • Resource-based policies with Flask-Pundit
  • Swagger codegen

There are a lot of decisions to make when creating an API, and a lot of problems that don’t seem to have a standard solution. So what’s yours?

Discussion

markdown guide
 

Programming languave typescript
Framework :Nestjs framework
API : (inbuilt)Nestjs graphql package(Apollo)
Documentation: (inbuilt) graphql playground
ORM: nestjs-typeorm package

Graphql rocks since trying it out I have rarely ever gone back to REST

 

Oooo a GraphQL answer with TypeScript! I’ve been wanting to try this sort of solution and tried (and failed) to do so with Node (express I think).

Do you have a recommended tutorial / example / anything I could get started with trying NestJS?

 

There is this example here github.com/nestjs/nest/tree/master... will make a git of nest js , graphpl MySQL simple crud and share it

 

I'm in love with GraphQL so I'm currently using this approach instead of traditional REST APIs.

  • Python (with async features and co-routines)
  • Starlette, an async Python framework with great GraphQL support.
  • GraphQL
  • Starlette comes with GraphiQl which is a great tool for API testing and documenting.
  • Starlette middlewares are providing a pretty decent solutions for all Authentication/Authorization tasks
  • Since I'm focused on GraphQl I'll go with React + Apollo on client side.
 

I haven’t heard of Starlette, I’ll take a look. Thanks!

 

Programming Language: PHP
Framework: Laravel
Scheme/spec/standard: JUR
Documentation: dunno
Authentication: firebase/jwt-php + Crypt::encrypt Laravel's facade
Authorization: Laravel's Gate
Client libraries: dunno

 

Thanks! I’ve only done a teeny tiny bit of PHP but it still rules the internet by usage. Glad to hear they have a framework which handles authorization for you.

I have used firebase for authentication from Go, it’s very easy and I strongly recommend it to anyone over doing your own password storage/hashing.

 

I share your pov, I prefer firebase authentication over Laravel passeport mostly because I like to integrate it in my client, so I do least server side code possible, yet Laravel make me earn so much time :)

 
  • C#
  • .NET Core WebAPI
  • REST
  • Postman for documentation and testing
 

I keep wanting to try out C#, but that requires me to spend time on Windows which I barely use 🙃.

Does .NET have a good way of exporting stuff to Postman or do you have to write your docs / tests independently of your code?

 

Cool thing is .Net Core doesn't run only on Windows.

This! 👆👆

I do all of my C#.NET development on a Mac.

As for exporting from .NET to Postman though, I actually work the other way around. I try to define the APIs first with their request data, possible responses, etc. You can then generate server / client code from there. However, I do typically write the two separately still.

Right on, I’ll definitely try out C# then from the confort of my home OS :). Do you have a recommended starting point? Meaning a favorite tutorial or book or website?

 

Well, I am a Symfony dev so here goes:

  • PHP
  • Symfony
  • JSONAPI docs
  • Apicurio
  • JWT
  • Authorization: Symfony Guard
 

Another PHP framework which handles authorization, nice! Maybe it’s just Flask that doesn’t have a standard method 😅.

Haven’t done anything with JSONAPI, I’ll have to check it out.

 

I found this neat tool where I don't need to write any code:
Instantwebapi.com
It generates the code for web API and unit tests!