How to serve a REST API on Heroku - javascript

I've built a REST API that works well if I host it locally. I followed this tutorial:
http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/
How can I serve this on heroku or any other online platform so my app can execute CURL commands?
Here is the code I used:
https://github.com/taboada92/wham
Thanks

You need to add a Procfile to your project so heroku will know what to execute. If are new to Heroku + Node, I suggest going through the tutorial

Related

Strapi deployment

I am new to Strapi and I found it really good, I got my website in development mode locally working perfectly fine but I can not get my head around or find any good guide how to host Strapi on Debian Linux server, that I have, to be part of website and to access Strapi control panel for example mywebiste.com/admin so I can add content as blog posts directly by logging in to website admin part. Is that possible or I must use some services like Heroku. if someone can provide in short step by step what to do I will really appreciate that. I tried already create new Strapi project inside public_html folder but its not working
I use strapi on my project . I hosted strapi on pm2 package. Its very easy.
this documention https://docs.strapi.io/developer-docs/latest/guides/process-manager.html#install-pm2
don't forget add startup Ubuntu to pm2. Otherwise when Ubuntu started then not starting pm2
I suggest use Ubuntu.
Nginx Configuration
In order to deploy it to a Linux server, you need to install nginx, and set it up. You can find instructions in official documentation: https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment/optional-software/nginx-proxy.html#nginx-virtual-host

What are the solutions for deploying Docker-based app in private production environment?

This is my first post on SO after a long time using it.
In advance, please apologize for my English ;)
Currently, I am working on an app that needs to be Dockerized. This app will be deployed on just one server in a private network. (We assume that the customer will not have access to the internet.)
To sum up, I build my app with a docker-compose.yml file. It consists of 2 nodejs app and a mongodb server.
What are my solutions to deploy this app in a private customer environment with only one server?
Thanks by advance.
finally, my research did great. I think I found a solution to my problem.
Because I'm using 2 node.js apps, and a MongoDB server, I will use PM2.
https://pm2.keymetrics.io
PM2 is a tool that will help to manage, monitor, restart in case of failures multiple node.js process.
I will just use this tool to make my project production ready (just npm and pm2 to install on the server) and talk about Docker for further investigations.
Thank you,

Problems uploading an application to HEROKU, Failed with async. H12

when trying to deploy my app in heroku, I get this error:
I'm trying to search the net but I can't find anything definitive. Just say that it works perfect for me at local. I use MAMP, the database is in myphpadmin and I think I imported it correctly in Heroku. The .env variables that I have are:
BD_NAME = agencydeviajes
BD_USER = root
BD_PASS = root
BD_HOST = 127.0.0.1
BD_PORT = 8889
HOST = localhost
My heroku variables:
And this is my repository: Git HUB Repository
I haven't been able to find a solution for more than a week and I'm a little desperate, I appreciate a lot of ideas. This is the error log.
I am new to Heroku and I am learning Java Script. Thank you very much to all
I don't think you can reference localhost on heroku. Try using postgres url instead, e.g: postgres://dbUserName:dbPassword#db.server:dbPortNumber/dbName.
its easier to manage. Heroku has a postgres service to. You could follow this link to learn more about the postgres addon on heroku

How to solve "Access-Control-Allow-Origin"-Issue in vue.js?

Im new to vue.js and webpack. I currently have a very big trouble to archive the next step: communicate with real-world-apis in a dev env.
what i currently do is:
npm run dev
my application calls an remote api to which i have no access.
then i run into the Access-Control-Allow-Origin-Issue.
If i build my application and run it with xampp everything works fine.
What can i do, to simply develope my application instead to hassle with that security thing?
I have tried to create a proxy, so i have already looked at:
npm cors (node-cors-client and node-cors-server) - but how does that apply to my vue app?
socket.io - but it seems to be overkill
http-server - but i got the same issues here
nuxt - could work, but then i need to refactor my vue.js app to nuxt and i dont know if this works then
any suggestions? Thanks!
Solved:
I ended up with a PHP-API
The PHP-API runs with xampp under port 80
The Vue.js-App runs with npm dev server under port 8080
The CORS-Hassle must solved then in the PHP-Script with:
https://stackoverflow.com/a/9866124/3918455

How can i start WebRTC sample application?

I've read a lot of documents about webRTC. Now I want to implement a sample application. I went through this useful stack overflow question.
And I got some client, a server in Javascript. I don't know how to start to see this demo . What are the steps should I take?
They explained like :
signaling technology: WebSockets
client: pure html/javascript
server: node.js, ws
last tested on: Firefox 40.0.2, Chrome 44.0.2403.157 m, Opera 31.0.1889.174
I understand this but I don't have much practical knowledge on this. These are my questions to setup this demo ?
Should I have a hosting account ? or can I use this with my
localhost ?
Next , where should I done this node.js, ws ? can I use with linux
machine and install npm and run the server.js file on that ?
How can I start client.js code on my Linux machine ?
Only server.js and client.js file is required to setup this
application ?
I am new with WebRTC too, but i hope my answer can satisfy you
You can use that demo in localhost
You can install nodejs in linux machine and run server.js on that.
To run the demo
run server.js through nodejs. Make sure you installed ws package first.
then you create a directory name static and put client-side code in there.
open your browser and go to localhost:80 to see the demo.
Yes, you just need 2 files to setup that application. The client file in Working Hello World WebRTC DataChannel Examples with Signaling Implemented is a html file not javascript.
You can see another tutorial in here: http://www.tutorialspoint.com/webrtc/webrtc_environment.htm
Sorry for my bad English.

Categories