Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

express server typescript

//yarn add express cors
//yarn add @types/cors @types/express --dev

import express from 'express';
import cors from 'cors'; 

const app = express();
const router = express.Router()

router.get('/', function (req, res) {
  res.send("All systems operational")
})

app.use(cors());
app.use(router);
app.listen(3000, () => console.log('Listening on port 3000'));
 
PREVIOUS NEXT
Tagged: #express #server #typescript
ADD COMMENT
Topic
Name
4+5 =