Freecodecamp's Back End Development and APIs Project.
Tags: webdev, javascript, backenddevelopment, node
Published: 2024-06-18 16:12:37

---
title: Freecodecamp's Back End Development and APIs Project.
published: true
description: This is node(express).js project for freecodecamp's backend development and apis certificate.
tags: webdev, javascript, backenddevelopment, nodejs
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-06-18 14:20 +0000
---
Most of [freecodecamp](https://www.freecodecamp.org)'s certificate tests need a simple codepen work. But, from backend development and apis section, it needs a user to configure a whole project and build using gitpod, online tool.
This post is for [freecodecamp's backend development and apis projects](https://www.freecodecamp.org/learn/back-end-development-and-apis/). Freecodecamp's backend development and apis project consists of 5 microservice projects like following:

-     Timestamp Microservice
-     Request Header Parser Microservice
-     URL Shortener Microservice
-     Exercise Tracker
-     File Metadata Microservice

Of course these projects are not difficult to the users who took the all courses that freecodecamp provides.
But I created a node.js project for [freecodecamp's backend development and apis projects](https://www.freecodecamp.org/learn/back-end-development-and-apis/) to help developers to understand and pass more easily.
To simplify, I integrated 5 projects into one express projects using router.
Unfortunately, as those projects have some same api endpoints, you should activate and run one by one separately.
Structure of the project is following:

- **models** folder: includes two mongoose models for exercise tracker microservice project(fourth project)
- **routes** folder: includes 6 express router files(five for individual projects and one for home)
- **public** folder:** contains data.json(for third, url shortener project) and style.css(I didn't care about styles, as it is for backend api functions). 
- **uploads** folder: it is for last project(file metadata microservice)
- **views** folder: includes 5 index.html files(each one for each project)
- _app.js_: main express app file(you will work here mostly)
- _server.js_: main endpoint file for node project

For example, if you build and run the project for "URL Shortener Microservice", third task, you should do like following:
- First, in _app.js_ file, change the home page into _views/index3.html_ and uncomment _require_ statement for express router(_urlShortener_ in this case) and _app.use_ statement with that router.

```
app.get('/', function(req, res) {
  res.sendFile(process.cwd() + '/views/index1.html');
});

const home = require('./routes/homeRoute');
// const timestamp = require('./routes/timestampRoute');
// const headerParser = require('./routes/headerParserRoute');
const urlShortener = require('./routes/urlShortenerRoute');
// const exTracker = require('./routes/exTrackerRoute');
// const metadataRouter = require('./routes/metadataRoute');

app.use('/api', home);
// app.use('/api', timestamp);
// app.use('/api', headerParser);
app.use('/api', urlShortener);
// app.use('/api', exTracker);
// app.use('/api', metadataRouter);
```

- Second, build and run the project.
`npm run start`

For other projects, do the same thing as above.
Here are running screens for each project.

-     Timestamp Microservice project

![Screen for Timestamp Microservice project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/88ud0e0cepqt804zuubt.png)

-     Request Header Parser Microservice project


![Screen for Request Header Parser Microservice project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6u3s3ko93ntdjzgtkvzw.png)

-     URL Shortener Microservice project

![Screen for URL Shortener Microservice project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpdv6elsjz6i2piu2wmk.png)

-     Exercise Tracker project

![Screen for Exercise Tracker project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q19rpxo1f47p9dtw2j8e.png)

-     File Metadata Microservice project

![Screen for File Metadata Microservice project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/124ciena6sjmisjcqwd4.png)

You can download full codebase from [my git repository](https://github.com/highsoft85/freecodecamp-backend-api-dev).
I hope it would be helpful to you.