- Set up a served with express.
- Make the routes and pass the parameters.
- Perform rendering with an Ejs template engine
Let's create an application using Express JS. In it, we will have an array of 5 names and two routes.
-
One will be of type "/person" and the other will be "/person/:p arameter".
-
When we enter the first path, it will return the array; while when we enter through the second, the requested person will return us.
Recommended items:
-
Make the example more complex.
-
Create a formal look.
- JavaScript
- NodeJS
- ExpressJS
- EJS
- Git
- GitHub
- Como hacer un README
- Run the clone repository in your terminal:
git clone https://github.com/d-maza/PC2-NODE-EXPRESS.git
- Access the folder with the command:
cd PC2-NODE-EXPRESS
- Remember that it is necessary to have NodeJS installed, download the dependencies with the command.
npm i
The exercise is run in the app.js file of the folder:src
cd src
node app
If you find anything that can be improved, please submit a pull request.