Skip to content

Instantly share code, notes, and snippets.

Created July 20, 2023 07:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
final code
const express = require('express')
const cors = require('cors')
const app = express();
const about = require('./routes/about')
//middleware for server
//to make API publicly accessible
//Register router from about
app.use('/about', about)
app.get('/', (req, res) => {
res.json('Welcome to the API')
//Listen for a connection
const port = process.env.PORT || 5500;
app.listen(port, () => console.log(`Listening to Port: ${port}`))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment