Deploy your Angular 7 app with Cloud Foundry on SAP Cloud Platform

In this tutorial, I will show how to deploy an Angular 7 app to Cloud Foundry on SAP Cloud Platform.

Prerequisite

The first thing is to install the Angular CLI globally

sudo npm install -g @angular/cli

Note that you must have installed node (v8.9 or higher) and npm (v6.0 or higher)

Frontend

To start quickly and for the demonstration, we will download the CLI starter kit from angular.io website (https://angular.io/generated/zips/cli-quickstart/cli-quickstart.zip). Once you get the zip file, just unzip and follow the next steps with your terminal below.

cd cli-quickstart
npm install
ng serve

Open your browser on http://localhost:4200/ to test the result, you might get something like this:

Great. The project is working locally. Now if you open the package.json file, you will see different scripts to lint, test, build, e2e, etc. The command which is interesting for us is to build the project for production. In order to push this to Cloud Foundry later.

Launch the build script with the following command:

npm run-script build

Frontend is ready.

Backend

For the demo, I wanted to add an API. The steps are easy, the first step is to create a folder api at root of your project.

mkdir api

In this new folder, create two files: server.js and package.json

server.js

var express = require("express");
var app = express();

app.listen(process.env.PORT || 3000, () => {
console.log("Server running.");
});

app.get("/demo", (req, res, next) => {
res.json(["Hello","World"]);
});

package.json

{
"name": "angualar-7-backend",
"version": "0.0.1",
"scripts": {
"start": "node server"
},
"dependencies": {
"express": "^4.16.4"
}
}

Backend is ready.

Prepare for production

Now we have to create new files specifically for Cloud Foundry deployment. The first file is manifest.yml and it allows you to declare the url of the app/service, the memory, disk_quota, etc. You have to create this file at the root folder of your project:

manifest.yml

---
applications:

- name: angular-7-frontend
host: angular-7-frontend
path: dist
buildpack: staticfile_buildpack
memory: 512M
disk_quota: 512M
instances: 1
random-route: true

- name: angular-7-backend
host: angular-7-backend
path: api
buildpack: nodejs_buildpack
memory: 512M
disk_quota: 512M
instances: 1
random-route: true

The second file is .cfignore

node_modules
api/node_modules

Deployment is ready.

Push to production

Before to push, make sure you are connected (and linked to the right spaces in case you have several). To connect to CF account, execute the following command and follow the steps from the CLI:

cf login
# enter email address
# choose your space

Time to push!

cf push

Done 👍

Useful links

171 Comments Deploy your Angular 7 app with Cloud Foundry on SAP Cloud Platform

  1. replica Rick Owens

    856731 4169Hello there! I could have sworn Ive been to this blog before but right after checking through some with the post I realized its new to me. Anyhow, Im undoubtedly glad I discovered it and Ill be bookmarking and checking back regularly! 636751

    Reply
  2. 3d printer

    135036 915408I like the valuable information you offer inside your articles. Ill bookmark your weblog and check once again here frequently. Im quite certain I will learn plenty of new stuff proper here! Good luck for the next! 520855

    Reply
  3. https://bit.ly/3gHGpTI

    Greetings from Ohio! I’m bored to death at work so I
    decided to browse your website on my iphone during lunch break.

    I really like the information you provide here and can’t wait to take a look when I
    get home. I’m amazed at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyways, awesome site!

    Take a look at my webpage – delta 8 gummies; https://bit.ly/3gHGpTI,

    Reply
  4. kitsapdailynews.com

    Hi there outstanding website! Does running a blog similar to this require a large amount of work?
    I have very little knowledge of programming but I had been hoping to start my own blog
    in the near future. Anyways, should you have any suggestions or tips for
    new blog owners please share. I understand this is off topic however I just
    needed to ask. Appreciate it!

    Review my web-site – THC Gummies (kitsapdailynews.com)

    Reply
  5. weed near me

    A fascinating discussion is worth comment.

    There’s no doubt that that you should write more about this issue, it might
    not be a taboo subject but typically people do not speak about these subjects.
    To the next! Kind regards!!

    Also visit my web-site weed near me

    Reply
  6. where to buy weed

    Great post. I was checking constantly this weblog and I am inspired!
    Extremely useful info specially the ultimate phase :
    ) I maintain such information a lot. I was seeking this certain info for a long time.
    Thank you and good luck.

    Also visit my site: where to buy weed

    Reply
  7. buy weed

    Hola! I’ve been reading your site for a long time now and finally got the courage to go ahead and give
    you a shout out from Humble Tx! Just wanted to say keep up the great work!

    Also visit my webpage; buy weed

    Reply
  8. Gerardfuege

    Erectile function that you are many as impotence. http://fitnessdom.ru/ Men who have erectile dysfunction is enough to have erectile dysfunction to your peni veins. If you are ‘secondary. Erectile dysfunction. Sometimes, can be a treatable Erectile dysfunction (ED) is important to work with blood can flow out through the peni veins.

    Reply
  9. cbd for sale

    Do you mind if I quote a couple of your
    posts as long as I provide credit and sources back to your weblog?

    My blog is in the very same niche as yours and my
    visitors would really benefit from some of the
    information you present here. Please let me know if this okay with you.
    Thanks!

    Have a look at my blog :: cbd for sale

    Reply
  10. can i give

    Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is fundamental and everything. Nevertheless imagine if you added some great photos
    or videos to give your posts more, “pop”! Your content is excellent but with
    images and clips, this website could undeniably be one of the greatest in its niche.
    Great blog!

    Here is my blog post :: can i give

    Reply
  11. 더나인카지노

    I’ll immediately snatch your rss as I can not to find your e-mail
    subscription hyperlink or e-newsletter service.
    Do you’ve any? Kindly allow me recognise
    in order that I may just subscribe. Thanks.

    Reply
  12. 퍼스트카지노

    I was recommended this website by my cousin. I am not sure
    whether or not this put up is written by means of him as
    no one else recognise such unique approximately my
    problem. You’re amazing! Thank you!

    Reply
  13. 더킹카지노

    Write more, thats all I have to say. Literally, it
    seems as though you relied on the video to make your point.
    You definitely know what youre talking about, why throw away your intelligence on just posting videos
    to your blog when you could be giving us something
    enlightening to read?

    Reply
  14. 1xBet

    Howdy very cool web site!! Man .. Beautiful .. Wonderful
    .. I will bookmark your web site and take the feeds additionally?
    I’m glad to find numerous helpful info here within the post, we need develop more techniques on this regard, thank you for sharing.
    . . . . .

    Reply
  15. 제왕카지노

    You really make it seem so easy along with your presentation however I in finding this topic to be actually one thing which
    I feel I might by no means understand. It kind of feels too complicated
    and very extensive for me. I am taking a look forward
    to your next put up, I’ll try to get the hang of it!

    Reply
  16. 우리카지노

    I am really impressed with your writing skills and also with the layout on your blog.
    Is this a paid theme or did you customize it yourself?
    Anyway keep up the nice quality writing, it is rare to see a great blog like
    this one these days.

    Reply
  17. 코인카지노

    Hi, Neat post. There is a problem along with your website in web explorer, might test this?
    IE nonetheless is the market chief and a good component of other people will leave out
    your magnificent writing due to this problem.

    Reply
  18. 빅카지노

    My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using Movable-type on several websites for about a
    year and am worried about switching to another platform.
    I have heard great things about blogengine.net.
    Is there a way I can import all my wordpress content into it?

    Any kind of help would be greatly appreciated!

    Reply
  19. 더나인카지노

    I like the valuable information you provide in your articles.
    I will bookmark your blog and check again here regularly.

    I’m quite sure I will learn many new stuff right here!
    Best of luck for the next!

    Reply
  20. 제왕카지노

    Hi this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG editors
    or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so
    I wanted to get guidance from someone with experience. Any help
    would be greatly appreciated!

    Reply
  21. slots

    With havin so much written content do you ever run into any problems of plagorism or copyright infringement?
    My website has a lot of unique content I’ve either created myself or
    outsourced but it seems a lot of it is popping it up all over the internet
    without my authorization. Do you know any ways to help stop content from being ripped off?
    I’d really appreciate it.

    Reply
  22. 더나인카지노

    I was wondering if you ever considered changing the
    page layout of your blog? Its very well written;
    I love what youve got to say. But maybe you could a little more in the way of content
    so people could connect with it better. Youve got an awful
    lot of text for only having 1 or two pictures.
    Maybe you could space it out better?

    Reply
  23. 우리카지노

    Heya i’m for the first time here. I came across this board and I
    find It really useful & it helped me out a lot. I hope to give something back
    and help others like you aided me.

    Reply
  24. 바카라

    I do not even know how I ended up here, but I thought this post was good.
    I don’t know who you are but certainly you’re going to
    a famous blogger if you aren’t already 😉 Cheers!

    Reply
  25. 에비앙카지노

    Hello just wanted to give you a quick heads up.
    The text in your article seem to be running off the screen in Opera.
    I’m not sure if this is a format issue or something to
    do with internet browser compatibility but I figured I’d post to
    let you know. The layout look great though! Hope
    you get the problem fixed soon. Cheers

    Reply
  26. 코인카지노

    Somebody essentially lend a hand to make severely articles I’d state.
    This is the first time I frequented your website page
    and thus far? I amazed with the research you made to make this particular post amazing.
    Great job!

    Reply
  27. 더나인카지노

    hello!,I love your writing so a lot! share we keep up a
    correspondence extra approximately your article on AOL?
    I need a specialist on this space to unravel
    my problem. May be that’s you! Looking forward to see you.

    Reply
  28. 메리트카지노

    Hello terrific website! Does running a blog like this take a large amount of
    work? I have very little expertise in computer programming however I was hoping to start my own blog
    soon. Anyways, if you have any ideas or tips for new blog owners please share.
    I understand this is off subject nevertheless I just wanted to ask.

    Thank you!

    Reply
  29. 파라오카지노

    Hi! Someone in my Facebook group shared this website with us so I came to give it
    a look. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers!

    Excellent blog and superb design.

    Reply
  30. 에비앙카지노

    Howdy I am so grateful I found your web site, I really found you by
    accident, while I was looking on Google for something else,
    Regardless I am here now and would just like to say kudos for a
    marvelous post and a all round enjoyable blog (I also love the
    theme/design), I don’t have time to read it all at the minute
    but I have bookmarked it and also added in your RSS feeds, so when I have time I will
    be back to read a great deal more, Please do keep up the fantastic b.

    Reply
  31. 코인카지노

    Hey there! I know this is somewhat off topic but I was wondering which blog platform are you using for this website?
    I’m getting fed up of WordPress because I’ve had problems with hackers and I’m looking at alternatives
    for another platform. I would be awesome if you could point me in the direction of a
    good platform.

    Reply
  32. 샌즈카지노

    Hi there! Quick question that’s totally off topic. Do you
    know how to make your site mobile friendly? My web site looks weird when viewing
    from my iphone4. I’m trying to find a theme or plugin that
    might be able to resolve this problem. If you have any suggestions, please share.
    Many thanks!

    Reply
  33. 더킹카지노

    Oh my goodness! Amazing article dude! Thanks, However I am going through issues with your RSS.
    I don’t understand why I cannot join it. Is there anybody getting identical RSS problems?
    Anyone that knows the answer can you kindly respond? Thanx!!

    Reply
  34. 빅카지노

    Hello are using WordPress for your blog platform? I’m new to the
    blog world but I’m trying to get started and create my own.
    Do you require any coding knowledge to make your own blog?

    Any help would be really appreciated!

    Reply
  35. 21 Casino

    Wow, marvelous blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your site is wonderful, let alone the content!

    Reply
  36. 솔레어카지노

    Howdy! This blog post couldn’t be written any better! Looking at this post reminds me of my
    previous roommate! He always kept talking about this.
    I’ll send this post to him. Pretty sure he’ll have a great read.
    Many thanks for sharing!

    Reply
  37. 퍼스트카지노

    Its such as you learn my thoughts! You seem to know so much approximately this, such as you wrote the ebook in it or something.
    I feel that you simply could do with some percent to drive the message house
    a little bit, but other than that, that is wonderful blog.

    An excellent read. I will certainly be back.

    Reply
  38. 더킹카지노

    Sweet blog! I found it while surfing around on Yahoo News.
    Do you have any tips on how to get listed in Yahoo
    News? I’ve been trying for a while but I never seem to get there!
    Appreciate it

    Reply
  39. 솔레어카지노

    Good day! This post couldn’t be written any better!
    Reading this post reminds me of my old room mate! He always kept talking about
    this. I will forward this post to him. Fairly certain he will have
    a good read. Many thanks for sharing!

    Reply
  40. 빅카지노

    First off I would like to say fantastic blog! I had a quick question that I’d
    like to ask if you don’t mind. I was curious to find out how you center yourself
    and clear your head prior to writing. I’ve had difficulty clearing my thoughts in getting my ideas out.
    I do take pleasure in writing however it just seems like the first 10 to 15 minutes are usually lost
    just trying to figure out how to begin. Any recommendations or tips?

    Many thanks!

    Reply
  41. 퍼스트카지노

    Hello! I know this is somewhat off-topic but I needed to ask.

    Does operating a well-established blog like yours require a lot of work?
    I’m completely new to writing a blog but I do write in my diary everyday.
    I’d like to start a blog so I can share my personal experience and
    feelings online. Please let me know if you have any ideas or tips for brand new aspiring blog owners.
    Thankyou!

    Reply
  42. 카지노

    I am now not positive the place you are getting your
    info, however good topic. I must spend some time learning much more
    or figuring out more. Thank you for great information I used to be looking for this info for my mission.

    Reply
  43. 더나인카지노

    Do you mind if I quote a couple of your posts as long as I provide
    credit and sources back to your site? My website is in the exact same niche as yours and my visitors would really benefit
    from a lot of the information you provide here. Please let me know if this okay with you.
    Many thanks!

    Reply
  44. roulette

    Hello there, just became aware of your blog through Google, and found that it
    is truly informative. I am gonna watch out for brussels.
    I’ll be grateful if you continue this in future.
    A lot of people will be benefited from your writing.
    Cheers!

    Reply
  45. 더킹카지노

    Very great post. I simply stumbled upon your blog and wished to
    mention that I have truly loved surfing around
    your weblog posts. In any case I’ll be subscribing on your rss
    feed and I am hoping you write once more soon!

    Reply
  46. 더나인카지노

    Fantastic blog! Do you have any hints for aspiring writers?
    I’m hoping to start my own website soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There
    are so many choices out there that I’m completely overwhelmed ..
    Any recommendations? Thank you!

    Reply
  47. Trada Casino

    Hi, Neat post. There’s an issue with your web site in internet explorer, could check this?
    IE still is the marketplace leader and a good component of
    other people will pass over your excellent writing due to this problem.

    Reply
  48. ‎カジノゲーム

    Amazing blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple adjustements would really make
    my blog stand out. Please let me know where you got your theme.

    Thanks

    Reply
  49. ジパングカジノ勝てない

    It is the best time to make a few plans for the long run and it’s time to be happy.

    I have read this submit and if I could I desire to recommend you some interesting issues
    or advice. Perhaps you could write subsequent articles regarding this article.
    I want to read even more things approximately it!

    Reply
  50. 원엑스벳

    Do you mind if I quote a few of your articles as long
    as I provide credit and sources back to your site?
    My blog site is in the exact same area of interest as yours and my users would really benefit from some of
    the information you provide here. Please let me know if
    this alright with you. Thanks a lot!

    Reply
  51. inter casino

    I’m not that much of a internet reader to be honest
    but your blogs really nice, keep it up! I’ll go ahead
    and bookmark your website to come back in the future.
    All the best

    Reply
  52. カジノ ルーレット

    Wonderful blog! Do you have any recommendations for aspiring writers?
    I’m hoping to start my own website soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or
    go for a paid option? There are so many options out there that I’m totally overwhelmed ..
    Any ideas? Cheers!

    Reply

Leave a Reply

Your email address will not be published.