The beginner’s guide to easy API building and server-side development

Nishchal Raj
MindOrks
Published in
3 min readJan 20, 2019

--

First of all, let me say “this blog post is not about initializing how to write API’s code or how to make a successful back-end code run on the server”. If you are into application development, of course you have heard the term API(Application Program Interface) or back-end development or full stack developer. And what are these?(in case you don’t know try Googling them).

Coming to the point, if you are deciding to build an API and have no idea where to start, this is right place you came over. Below are the steps that can be familiar to guide you into proper API building and back-end development:

  1. Look for the available languages that can be easy for you to code into and you can run your server easily through that or you can select any such server-side languages and frameworks for API too. Note to select a comfortable database also which you will further connect to if needed. Frameworks, because they will make the spinning of server easy and will also help you in building a better API. For the best available options you can check here.

2. Always make note of the routes, the functions those routes will provide to the user and the administrator, and the database schema so that you can easily work on the MVC architecture which is till date is greatly used by the developers around the globe.

3. Now, when every thing is decided there is a goal you need to reach to and you can now see the way to achieve it also. I hope you have installed the packages and tools needed to achieve the goal with your preferred language.

4. Start the server first and try to display the famous “Hello World”, either in the console or in the http://localhost:port/ in your browser. This will confirm that the server is running locally on your machine and you can carry on rest of the work.

5. Create a file which will direct any request coming to the server to the proper routes assigned and if not, then it is better to accept the error handling approach while doing this.

6. Create the files for the routes and import the frameworks/libraries needed and carefully code the functions with proper validation for every incoming request, because “never trust the client’s input”.

7. Now, it’s time to connect the database you have selected to use. For an example you can have a look here.

8. Simultaneously to the above step, do the modelling of the data that you will require according to the database schema and never forget to import the necessary files.

9. Then, connect the models to the routes created in the above steps. And for that import the model’s file in the proper route’s file or to be more precise, the controllers file.

10. For every route that is created, configure the database actions with proper response to each of them, i.e. for the errors too. To every request, there should be a proper detailed response. Don’t leave any stone unturned.

11. This step is optional. If any authentication is needed then try using the best way and never use the plain text form. There are so many options for this step, and hence I will leave this on you.

For more you can surely ping me here.

--

--

Nishchal Raj
MindOrks

Co-Founder @ Paisa App | Technical Speaker @ ALCCalabar - Google I/O '22 Extended-BLRKotlin #30 | Ex-GDSC Lead | Writer | Researcher | @thenishchalraj