Getting Started with Your First App
Welcome to the guide on building your first app with our platform! This document will help you set up your development environment and create a simple application.
Prerequisites
Before you begin, ensure that you have the following installed:
- Node.js (version 14 or higher)
- npm (Node Package Manager)
Setting Up Your Environment
- Install Node.js: Download and install Node.js from the official website.
- Verify Installation:
Ensure that both commands return version numbers indicating successful installation.node -v npm -v
Creating Your First App
Now that your environment is set up, let's create a simple application.
Step 1: Initialize Project
Open your terminal and run:
mkdir my-first-app
cd my-first-app
npm init -y
Step 2: Install Dependencies
Next, install the necessary package:
npm install express
Step 3: Create Your App
Create a file named app.js:
const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});
Step 4: Run Your App
Finally, start your application by running:
node app.js
Visit http://localhost:3000 in your web browser, and you should see the message "Hello World!" displayed.