-3

I've been studying Front-end with Angular 4 for some time, and I have built a single page application with it, the app is a just a form for now, and now I need to create a backend for it, and I have been having a really rough time understanding it, and the part that I've been having most trouble understanding is how to create a backend that fits with my existing frontend?

Andrew Radulescu
  • 1,862
  • 13
  • 21

2 Answers2

1

It seems that you are a little confused. First, you should understand what is the purpose of this 'backend'.

You have plenty of programming languages(Java, Python, JS, C#, etc) with different frameworks to use for creating the backend.

It's hard to believe that you need a backend for a Form-based application but anyway you better remain in your same hemisphere of JS syntax. Take a look at NodeJS here which you can use to instantly create a server or build a RESTful API.

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
   res.statusCode = 200;
   res.setHeader('Content-Type', 'text/plain');
   res.end('Hello World\n');
});

server.listen(port, hostname, () => {
   console.log(`Server running at http://${hostname}:${port}/`);
});

My advice is to read over the internet to understand how those both parts (Frontend and Backend) are interacting and what is the purpose of each.

Good luck!

Andrew Radulescu
  • 1,862
  • 13
  • 21
  • the thing is, I do understand how they interact, and I am looking at some backend programming with nodejs and express, and I have successfully created a backend code, and I understand post, get, delete and put, but I don t really understand how do I save the input in my html in the server , and the things in my server in my html. There is a bit of code that I am missing but I don t know what it is, I have used this tutorial: https://malcoded.com/posts/angular-backend-express What should I use to save the users? – Rodrigo Azevedo Mar 27 '18 at 17:05
  • Just take it easy. If you understand HTTP verbs this is really important but you really lack a database. Try to use Firebase along with Angular and you will have a surprise. You can save everything you want, retrieve, synchronize and more. Find some tutorials and don't stop learning. Good luck! – Andrew Radulescu Mar 27 '18 at 17:25
-2

I generally use apache to serve the static prod build and then have it point to a data.whateverDomain.com you have for data. So my mix is angular, apache, nodejs. I place the angular code in my /var/www/html and away I go...

Alex Mackinnon
  • 300
  • 3
  • 12