![]() This API will be able to support multiple versions. Server.js is the main script file we will need to start to run the API, main.js contains the bootstrapping code to set up everything from the api folder. At the end of this article I will offer a ZIP file containing the complete installable API on any computer having Node.JS installed.Īs you can see we have two sub folders called “api”, which has the main logic of our api and a config folder were we will put our DB connection stuff. On the following figure you can see the folder structure of our API we are going to create. I will follow a simple MC (Model-Controller) architecture, set up a version based API with some GET and POST function while connecting to the MongoDB Cloud (you can also connect to your local MongoDB). This API, once finished, could be integrated into systemctl on a Linux based OS to make it auto boot and even restart on crashes. Today it is very easy to set up a simple API, so i am going to show how to do that in 30 minutes. In this article I am going to describe a simple Node.JS based RESTful API I created for my app “Puckify” to collect some statistical data and in-app purchases users do. Often, API’s are even more important than the application itself, so starting to design and implement the API first makes sense. Today API’s are a must for most app’s running on devices collecting or fetching data of any kind or website’s either running as a single page application or simply fetching writing/reading data from its internal or some external system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |