Skip to content
Sign upLog in
← Back to Community
Making Own Simple api
Profile icon
SomeBall45

Hello beginners

I want to teach you how to create a Simple API using Node.js and Express

1. install express

npm install express

2. Import express on main.js

const express = require('express'); const app = express();

3. Make a server

app.get('/', (req, res) => { res.send(require("YOUR JSON FILEPATH")) }); app.listen(3000, () => { console.log('server started'); });

add a pathname you own

3. add JSON file

add JSON Files on file folder

4. run

run your repl

ending

that's all from here the tutorial, later see the repl below

Voters
Profile icon
AndersonSanto37
Profile icon
linnovateurlinn
Profile icon
Retrospicer
Profile icon
SomeBall45