CSUI Lecture Exercise: Backend Engineer in 5 Minutes
This is a supplementary exercise to an introductory backend engineering lecture at the University of Indonesia.
Let’s Make a Backend Application!
In this exercise, we’re going to create a backend application using Express, which is a web application framework that runs on Node.js.
You can see an example of the application here.
Prerequisites:
- Install npm on your device.
- Install any code editor such as Visual Studio Code.
- An internet connection.
1. Create a project folder
mkdir my-backend-app
Enter your folder
cd my-backend-app
2. Install express
npm install express --save
3. Create an index.js file with the following contents
const express = require("express");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
res.send({
message: "success",
});
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});
4. Run your application
node index.js
Your backend application is running 🥳
5. Create a GET request to your backend application
Run this in your terminal
curl http://localhost:3000
Or…
Open your browser (e.g. Google Chrome) and open http://localhost:3000.
You should get the following response
{
"message": "success"
}

Hooray! From now on, you are a certified backend engineer! 💪
References
Express.js. (n.d.). Express - Node.js web application framework. https://expressjs.com/