Last active
March 24, 2022 14:22
-
-
Save agusrichard/820d4c0ddc121317596cf251e9a1fb33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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