Skip to content

Commit

Permalink
adam
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamLavidyan committed May 7, 2020
1 parent f375692 commit 172ea64
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ let app = express()
app.use(cors())
app.use(bodyParser.json())

// verify JWT token middleware
app.use((req, res, next) => {

})

// For ease of this tutorial, we are going to use SQLite to limit dependencies
let database = new Sequelize({
dialect: 'sqlite',
Expand All @@ -22,10 +17,10 @@ let database = new Sequelize({

// Define our Post model
// id, createdAt, and updatedAt are added by sequelize automatically
let Post = database.define('posts', {
title: Sequelize.STRING,
body: Sequelize.TEXT
})
var User = database.define('User', {
username: Sequelize.STRING,
requested_resturant: Sequelize.DATE
});

// Initialize finale
finale.initialize({
Expand All @@ -34,16 +29,24 @@ finale.initialize({
})

// Create the dynamic REST resource for our Post model
let userResource = finale.resource({
model: Post,
endpoints: ['/posts', '/posts/:id']
})
var userResource = finale.resource({
model: User,
endpoints: ['/users', '/users/:id']
});

userResource.create
userResource.list
userResource.read
userResource.update

// Resets the database and launches the express app on :8081
database
.sync({ force: true })
.then(() => {

app.listen(8081, () => {
console.log('listening to port localhost:8081')
})
})
})


0 comments on commit 172ea64

Please sign in to comment.