Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Last active March 24, 2022 14:22
Show Gist options
  • Save agusrichard/820d4c0ddc121317596cf251e9a1fb33 to your computer and use it in GitHub Desktop.
Save agusrichard/820d4c0ddc121317596cf251e9a1fb33 to your computer and use it in GitHub Desktop.
import bodyParser from 'body-parser'
import express, { Request, Response } from 'express'
const PORT = 3000
const app = express()
app.use(bodyParser.json())
app.post('/register', (req: Request, res: Response) => {
const { email, password } = req.body
console.log('Registering user...')
return res.send('OK')
})
app.post('/login', (req: Request, res: Response) => {
const { email, password } = req.body
console.log('Login user...')
return res.send('OK')
})
app.get('/', (req: Request, res: Response) => {
res.send('Hello World')
})
app.listen(PORT, () => {
console.log(`Server is listening on port ${PORT}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment