I just found swagger-node and I have installed all of the dependencies.
Now I have a REST express api at /var/www/myApi this has already been created but needs documentation.
However no where in the documentation does it state how to use an already existing project with swagger.
I am able to create a new project and run it, but how do I use an existing project?
Related
I am struggling to find the way to have 2 Azure functions in different language(C# and node.js) in Azure functions Project vs 2017.
Is there a way to do that?
Thanks!
Update
This method is invalid for v2 function(runtime ~2) because now it's required to use single language in one function app. See announcement.
So, the 2 project doesn't replace the functions created by first project?
Do you mean that you found some functions are replaced after new project being deployed to Azure?
Normally they won't be replaced unless functions in new project has same function names as ones already deployed.
create Azure Functions in 2 different language(C#, node.js) under one VS project
#Mikhail is right, VS doesn't provide ways for using js Azure function. No template and debug support for now.
But if you just want to run and deploy them together using VS, with no need to debug nodejs function, there's a workaround.
Generally speaking, you have to manually add nodejs function folder structure to VS project as below.
A folder named after your js function includes function.json and xxx.js file. If you have some packages installed by npm, also add package.json and node_modules folder.
function.json, xxx.js and package.json should be set as Copy if newer, so that they can be included in output dir like c# complied dll.
Not need to include node_modules locally, function host will locate them automatically. While after deploying to azure, you need to visit kudu(https://{functionappname}.scm.azurewebsites.net/DebugConsole). Execute npm install in console under wwwroot folder to install packages in package.json.
And some function templates if needed.
I'm working in Orchard project & i want to implement WebApi in my project so that I plan to create one WebApi related separate module which handles all the database related code & returns the result to the other modules as well third party calls.
But for implementing like this, how can i publish my rest of the application at one place & the WebApi related module at another place.
You cannot run Orchard Modules without Orchard. If you want to separate site publishing from module publishing, you can update single modules. To do this you need to package you module and then upload and install it to the site. Either by Admin Dashboard or Orchard Command-line.
On how to package a module and install it with Orchard Command-line check the Orchard Doc's here
You can also upload the module package via Orchards Admin Dashboard. Check this Orchard Doc to accomplish this.
Important! Remember to update your module's version in Module.txt manifest file. Otherwise the update won't work.
I'm building a Node.js REST API. I have a repository which will hold this REST API code.
I want to be able to test my API. For now I'll just test via Express and make GET requests to start but I want my express stuff in a separate project because a REST API isn't gonna have any web app portion.
I'm using Webstorm. So right now I have created a gitHub repo to hold the API which I'll expose REST endpoints.
I want to create a new project also again that will be a Node-Express project for the purpose of pulling in the REST API and consume it. I am also doing this in a seperate project because I don't want my Express stuff checked into my REST API repo, it doesn't belong there. I am just using Express for testing stuff.
I realize I can later test my REST endpoints headless, but right now I just wanna get started and figure that out later and just going with an Express project to somehow consume my other API REST project.
I'm not quite sure on a few things, as I come from a .NET enviornment and no longer a .NET developer. Here are some questions I have:
My Question: If I have my Node Express project open in Webstorm, how would I "include" or "require" my rest-api? Would I somehow npm it down? But my REST api is not public. Would I just branch my git REST API repo down, then what? How would I include it into my seperate Express App project?
Or...do people usually still add express to their REST API projects anyway, maybe it doesn't matter?
You can use npm link to link a local package
$ cd main-project
$ npm link ../path/to/web-api
Then in your main project, you can require it as you would any other module
If you don't intend on publish it, the package.json in your web-api should have
{
"private": true
}
I want to develop an API using the MVC pattern. I found sails framework interesting and I'd like to know if it's possible to configure swagger or something like with sails to generate the documentation of my API (something like swagger-express for express for example).
Thanks!
This feature is in progress. If you'd like to help out, we can all collaborate here: https://github.com/balderdashy/sails/issues/1094
Update (August 2015):
Check out this Sails Hook that offers native Swagger integration. It compiles all of the bound routes in Sails, and generates a Swagger 2.0 document: https://github.com/tjwebb/sails-swagger
Here is what I did to have my documentation work with sails.js : you can download swagger-ui here : https://github.com/swagger-api/swagger-ui or via npm (npm install swagger-ui).
Then in the assets folder of your sails project, create a folder that points to the swagger folder ("docs" for example, so you'll be able to access to your documentation via your_url:port/docs)
I have successfully created a few loopback projects using
slc lb project *myproject*
command but now I have a pre-existing node project that I would like to use loopback in.
Is there a recommended best practice around the migration to loopback?
Is it just a matter of including the relevant module references in my package.json and running npm install? Or do also need to make some changes to my app.js?
Will I need to manually create the models.json and datasources.json?
Any insignts appreciated.
Edit: I added the relevant loopback modules to my package.json, replaced my express requires with loopback, manually added a datasources.json, and models.json and it all seems to have worked.
The only remaining issue is that when I bring up my explorer view the shell comes up but no api endpoints even though I have models defined in my models.json file.
Edit: I added the relevant loopback modules to my package.json, replaced my express requires with loopback, manulally added a datasources.json, and models.json and it all seems to have worked.
The only remaining issue is that when I bring up my explorer view the shell comes up but no api end points even though I have models defined in my models.json file.
To load and process models.json and datasources.json, you have to "boot" your LoopBack application.
Assuming you have installed loopback 2.x in your project, and you want to use the old 1.x project layout scaffolded by slc lb, here are the instructions:
Install loopback-boot 1.x. Make sure you are not using 2.x or newer, as 2.x changed the project layout.
npm install --save loopback-boot#1.x
Modify your main application file (e.g. app.js) and add the following lines:
// at the top
var boot = require('loopback-boot');
// after you have created `app` object
// and configured any request-preprocessing middleware
boot(app, __dirname);
Please consider using the new 2.x project layout, see Migrating apps to version 2.0 for information on how to migrate your "models.json" into the new format.
Is there a recommended best practice around the migration to loopback?
I suggest scaffolding a new app using slc loopback and moving your old apps files to the relevant directories.
is it just a matter of including the relveant module references in my package.json and running npm install or do also need to make some changes to my app.js?
This will be part of the migration process, you will also need to configure app.js to meet your needs (like setting up middleware, etc)
will I need to manually create the models.json and datasources.json?
No, when you scaffold the app using slc loopback, they will be automatically generated in the new project.
The only remaining issue is that when I bring up my explorer view the shell comes up but no api end points even though I have models defined in my models.json file.
Did you create the files in commmon/models manually? Try creating them through slc loopback:model and the tool will add the configurations in server/model-config.json for you.