API versioning in strapi - node.js

so by default strapi puts APIs into the api folder. But what if i want to version my APIs like v1/v2/v3 etc?
I didn't see any file that has the route to api folder.

Unfortunately, there is no api versioning provided by Strapi right now, but the feature is to be added soon and is there in their roadmap. Refer to their productboard here.
If you scroll down in the page mentioned above, you could see the idea request

Related

Is there a way to deploy Strapi project without admin panel?

As Strapi official docs point:
At the moment, deploying the Strapi Admin interface requires more than 1g of RAM.
Though in my project, I need only some basic actions with the server (like adding and viewing content), and I already do this via HTTP requests to api. So I would like to deploy only the "api" part itself and not admin panel logic. This way I can save resources & money. Is there a way to do it?
Please check Deploy the administration panel and the plugins on another server than the API
You can just delete the build folder. You do not need an admin panel.
Your REST or GraphQL API will work as the way it is.
You can do this only by making big changes to the main module of Strapi, after that you won’t be able to properly manage the permissions system and other main components, you will also lose the possibility of updates.
update
You can just make all configuration and remove web part from hosting

How to customise the Admin panel in Keystone JS? (Or: how do the custom admin pages in Keystone JS demo-project/blog work?)

We are looking to use KeystoneJS in a large project and we want to be able to customise the Admin panel. There's a nice example of how to do it here, and I've been reviewing this PR to the project. Although the example looks as if it would work for us, I don't understand the logic behind it, that is, what we would need to implement to make it work, what the possibilities and constraints are.
Is it the case that when you use the Keystone NextJS app (which is good for us), if you add a folder /admin/pages the Keystone app will look there and use those custom admin pages instead of the regular ones? I'm assuming we have full access to the rest of the app, the controllers, the DB from these pages as well....
I also noticed that JedWatson notes in https://github.com/keystonejs/keystone/pull/1019 that
Note this lacks SSR support, and I didn't put as much effort into the examples, but it's otherwise (I think) identical in functionality.
Does it lack SSR support just for the admin part, or does adding custom admin pages somehow affect SSR support in the rest of the app? (SSR is the reason we're using next)
Thanks for any info.
There are two api for custom pages, one is pages option in the admin-ui app constructor and 2nd is part of hooks api in keystone constructor.
pages: this one is legacy and only adds custom pages, it does not overwrite the existing list pages in admin-ui it only hides them if not properly configured. usually the Dashboard is visible and all lists are listed there.
hooks: this is new and expected to add more customization options, unfortunately my PRs are stale and they are not the spec keystone core team would want to add. this also does not removes any pages.
admin ui runs as react app built or loaded using webpack config. that is why there is no ssr support. even though the example use a custom admin directory but that not loaded by nextjs component, it is loaded dynamically using webpack server mounting the admin-ui react app
if you really want to have ssr, you can use some learning from closed PRs which were used as POC long ago. but that would be overkill as the admin-ui has many more updates after that.
hooks/pages have access to core limited set of access, there are some access based on React context, provider and consumer hooks. You can use react-apollo hooks as there is already provider wrapped at root of react context. you can also make use of react router hooks, they are upgraded to latest version. it has no access to server side context or controller. (not sure what you meant by controller)

How do you generate a live Swagger API page for your hosted Swagger API?

I have created an API using Swagger.
My customers will be able to make calls to my service like
https://theservice.com/data/items/category1/12345
This is fine and works ok.
However, I would like to have a page where they can see all available API calls, similar to how Swagger generates it on their SwaggerEditor app. For example by visiting https://theservice.com/index.html I would like them to see the API docs.
Is it possible (within Swagger) to do this on a live system (not just locally with swagger project edit which I already know)?
If yes, how?
It sounds like you're using the Swagger Editor to describe your API, then generating some scaffolding code using the built-in generator. From your tags, I assume this is node.js code. You'll need to add your own logic to the generated code to complete this API implementation (if you haven't already done so).
If this is correct, then the interactive Swagger-UI documentation you're looking for should be available in your generated API at /docs endpoint, relative to the base URL of your running service.
The generated node.js project includes the Swagger spec you created in the editor, and uses Swagger-Tools to do the runtime magic. Among other things, Swagger-Tools auto-wires your Swagger spec to the /docs endpoint, and manages routing of requests to the generated controllers, based on information provided in your Swagger spec.
Note that the /docs page will look and behave somewhat differently from the documentation widget you see in the Swagger editor. The one in your application uses Swagger-UI, which is the runtime component for documentation, with interactive sandbox testing. Swagger-Editor has its own built-in documentation UI, and this is not currently packaged for use outside of the Swagger-Editor.
If you've already implemented an API, independent of the Swagger editor and code generator, you can still generate node.js code to see how to incorporate Swagger-Tools into your existing API implementation. Or, as wing328 suggests, take a look at Swagger-UI to see how you can add your own documentation page.
I think what you're looking for is swagger-ui and here is an example: http://petstore.swagger.io/
As you can see, it not only lists out all the available API endpoints but also lets visitors (developers) to try it out directly in the web page.

Swagger is not generating API documentation for the `Node.js` project, why?

Swagger specification document is not being generated from Swagger integration into Node.js project as a sub project. However, SwaggerUI is up and running. If we provide say swagger.json or api-docs.json file then it is rendering specified REST API calls.
My requirement is to generate the API document for existing project. How do I do it ?
See this answer for help in deciding how to generate Swagger docs for a project.
You can either manually create the docs for your API and have Swagger UI serve them, or you can use a node package like swagger-node-express which will do most of the documenting automatically. See the link above for pros and cons of each of these options.

Complete migration guide for spotify

I'm looking for an complete migration guide for the new spotify app. I'm having a lot of event handlers for network change, app going to background and such. These are using constants like:
models.TOPLISTMATCHES.TRACKS
These are not included in the current API anymore. Is there any documentation on such details?
Full documentation on the new API can be found here for the API, and here for the views framework.

Resources